Skip to content

Commit

Permalink
update env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Nov 13, 2024
1 parent 5a81586 commit b812332
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion PlotsBase/src/Commons/Commons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module Commons

export AVec,
AMat, KW, AKW, TicksArgs, PlotsBase, PLOTS_SEED, _haligns, _valigns, _cbar_width
AMat, KW, AKW, TicksArgs, PlotsBase, _haligns, _valigns, _cbar_width
export get_subplot,
coords,
ispolar,
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/Commons/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const DEFAULT_BBOX = Ref(BoundingBox(0mm, 0mm, 0mm, 0mm))
const DEFAULT_MINPAD = Ref((20mm, 5mm, 2mm, 10mm))
const DEFAULT_LINEWIDTH = Ref(1)
const PLOTS_SEED = 1234
const SEED = 1234
const PX_PER_INCH = 100
const DPI = PX_PER_INCH
const MM_PER_INCH = 25.4
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ function test_examples(
PlotsBase.Commons.debug!($debug)
backend($(QuoteNode(pkgname)))
rng = $rng
rng nothing || Random.seed!(rng, PlotsBase.PLOTS_SEED)
rng nothing || Random.seed!(rng, PlotsBase.SEED)
theme(:default)
end)
(imp = _examples[i].imports) nothing || Base.eval(m, imp)
Expand Down
6 changes: 3 additions & 3 deletions PlotsBase/src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const _use_local_dependencies = Ref(false)
const _use_local_plotlyjs = Ref(false)

_plots_defaults() =
if isdefined(Main, :PLOTS_DEFAULTS)
copy(Dict{Symbol,Any}(Main.PLOTS_DEFAULTS))
if isdefined(Main, :PLOTSBASE_DEFAULTS)
copy(Dict{Symbol,Any}(Main.PLOTSBASE_DEFAULTS))
else
Dict{Symbol,Any}()
end
Expand All @@ -22,7 +22,7 @@ function _plots_theme_defaults()
end

function _plots_plotly_defaults()
if Base.get_bool_env("PLOTS_HOST_DEPENDENCY_LOCAL", false)
if Base.get_bool_env("PLOTSBASE_HOST_DEPENDENCY_LOCAL", false)
_plotly_local_file_path[] =
fn = joinpath(@get_scratch!("plotly"), _plotly_min_js_filename)
isfile(fn) ||
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function convert_to_polar(theta, r, r_extrema = ignorenan_extrema(r))
x, y
end

fakedata(sz::Int...) = fakedata(Random.seed!(PLOTS_SEED), sz...)
fakedata(sz::Int...) = fakedata(Random.seed!(SEED), sz...)

function fakedata(rng::Random.AbstractRNG, sz...)
y = zeros(sz...)
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for pkg ∈ TEST_PACKAGES
end

import Unitful: m, s, cm, DimensionError
import PlotsBase: PLOTS_SEED, Plot, with
import PlotsBase: SEED, Plot, with
import SentinelArrays: ChainedVector
import GeometryBasics
import OffsetArrays
Expand Down
4 changes: 2 additions & 2 deletions PlotsBase/test/test_defaults.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const PLOTS_DEFAULTS = Dict(:theme => :wong2, :fontfamily => :palantino)
const PLOTSBASE_DEFAULTS = Dict(:theme => :wong2, :fontfamily => :palantino)
PlotsBase._plots_theme_defaults()

@testset "Loading theme" begin
Expand All @@ -7,7 +7,7 @@ PlotsBase._plots_theme_defaults()
@test PlotsBase.guidefont(pl[1][:xaxis]).family == "palantino"
end

empty!(PLOTS_DEFAULTS)
empty!(PLOTSBASE_DEFAULTS)
PlotsBase._plots_theme_defaults()

@testset "default" begin
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/test/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end
@testset "Plotly standalone" begin
@test PlotsBase._plotly_local_file_path[] nothing
temp = PlotsBase._use_local_dependencies[]
withenv("PLOTS_HOST_DEPENDENCY_LOCAL" => true) do
withenv("PLOTSBASE_HOST_DEPENDENCY_LOCAL" => true) do
PlotsBase._plots_plotly_defaults()
@test PlotsBase._plotly_local_file_path[] isa String
@test isfile(PlotsBase._plotly_local_file_path[])
Expand Down
14 changes: 7 additions & 7 deletions PlotsBase/test/test_reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ci_tol() =
end

const TESTS_MODULE = Module(:PlotsBaseTestModule)
const PLOTS_IMG_TOL = parse(Float64, get(ENV, "PLOTS_IMG_TOL", is_ci() ? ci_tol() : "1e-5"))
const PLOTSBASE_IMG_TOL = parse(Float64, get(ENV, "PLOTSBASE_IMG_TOL", is_ci() ? ci_tol() : "1e-5"))

Base.eval(TESTS_MODULE, :(using Random, StableRNGs, PlotsBase))

reference_dir(args...) =
if (ref_dir = get(ENV, "PLOTS_REFERENCE_DIR", nothing)) nothing
if (ref_dir = get(ENV, "PLOTSBASE_REFERENCE_DIR", nothing)) nothing
ref_dir
else
joinpath(homedir(), ".julia", "dev", "PlotReferenceImages.jl", args...)
Expand Down Expand Up @@ -88,7 +88,7 @@ function image_comparison_tests(
PlotsBase.Commons.debug!($debug)
backend($(QuoteNode(pkg)))
theme(:default)
rng = StableRNG(PlotsBase.PLOTS_SEED)
rng = StableRNG(PlotsBase.SEED)
$(PlotsBase.replace_rand(example.exprs))
end
@debug imports exprs
Expand Down Expand Up @@ -127,15 +127,15 @@ end
#=
with(:gr) do
image_comparison_facts(:gr, tol = PLOTS_IMG_TOL, skip = PlotsBase._backend_skips[:gr])
image_comparison_facts(:gr, tol = PLOTSBASE_IMG_TOL, skip = PlotsBase._backend_skips[:gr])
end
with(:plotlyjs) do
image_comparison_facts(:plotlyjs, tol = PLOTS_IMG_TOL, skip = PlotsBase._backend_skips[:plotlyjs])
image_comparison_facts(:plotlyjs, tol = PLOTSBASE_IMG_TOL, skip = PlotsBase._backend_skips[:plotlyjs])
end
with(:pgfplotsx) do
image_comparison_facts(:pgfplotsx, tol = PLOTS_IMG_TOL, skip = PlotsBase._backend_skips[:pgfplotsx])
image_comparison_facts(:pgfplotsx, tol = PLOTSBASE_IMG_TOL, skip = PlotsBase._backend_skips[:pgfplotsx])
end
=#

Expand All @@ -146,7 +146,7 @@ end
@test backend_name() :gr
image_comparison_facts(
:gr,
tol = PLOTS_IMG_TOL,
tol = PLOTSBASE_IMG_TOL,
skip = vcat(PlotsBase._backend_skips[:gr]),
broken = broken_examples,
)
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function generate_cards(
write(jl, """
Plots.Commons.reset_defaults() #hide
using StableRNGs #hide
rng = StableRNG($(Plots.PLOTS_SEED)) #hide
rng = StableRNG($(Plots.SEED)) #hide
nothing #hide
"""
)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ pythonplot() # backends are selected with lowercase na
Plots will use the GR backend by default. You can override this choice by setting an environment variable in your `~/.julia/config/startup.jl` file (if the file does not exist, create it). To do this, add e.g. the following line of code: `ENV["PLOTSBASE_DEFAULT_BACKEND"] = "UnicodePlots"`.

!!! tip
You can override standard default values in your `~/.julia/config/startup.jl` file, for example `PLOTS_DEFAULTS = Dict(:markersize => 10, :legend => false, :warn_on_unsupported => false)`.
You can override standard default values in your `~/.julia/config/startup.jl` file, for example `PLOTSBASE_DEFAULTS = Dict(:markersize => 10, :legend => false, :warn_on_unsupported => false)`.
---

0 comments on commit b812332

Please sign in to comment.