Skip to content

Commit 2ef127b

Browse files
authored
add Preferences note (#331)
1 parent 487e10d commit 2ef127b

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

docs/ci_build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ if true; then
4646
export DOCUMENTER_DEBUG=true # Democards.jl
4747
fi
4848

49+
export LD_PRELOAD=$(g++ --print-file-name=libstdc++.so)
4950
export GKSwstype=nul # Plots.jl/issues/3664
5051
export COLORTERM=truecolor # UnicodePlots.jl
5152
export PLOTDOCS_ANSICOLOR=true
52-
export LD_PRELOAD=$(g++ --print-file-name=libstdc++.so)
5353

5454
julia='xvfb-run -a julia --color=yes --project=docs'
5555

@@ -77,6 +77,10 @@ $julia -e '
7777
Pkg.add("PyCall"); Pkg.build("PyCall"; verbose=true)
7878
'
7979

80+
export JULIA_PYTHONCALL_EXE=$($julia -e 'import Conda; print(joinpath(Conda.BINDIR, "python"))')
81+
export JULIA_CONDAPKG_EXE=$($julia -e 'import Conda; print(Conda.CONDA_EXE)')
82+
export JULIA_CONDAPKG_BACKEND=Null
83+
8084
echo "== build documentation for $GITHUB_REPOSITORY@$GITHUB_REF, triggerd by $GITHUB_ACTOR on $GITHUB_EVENT_NAME =="
8185
if [ "$GITHUB_REPOSITORY" == 'JuliaPlots/PlotDocs.jl' ]; then
8286
$julia -e 'using Pkg; Pkg.add(PackageSpec(name="Plots", rev="master"))'

docs/make.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,18 @@ function main()
813813
end
814814
end
815815

816+
# postprocess temporary work dir
817+
src = basename(SRC_DIR)
818+
for file glob("*/index.html", joinpath(@__DIR__, "build"))
819+
lines = readlines(file; keep=true)
820+
any((occursin("blob/master/docs", line) for line lines)) || continue
821+
open(file, "w") do io
822+
for line lines
823+
write(io, replace(line, "blob/master/docs/$work" => "blob/master/docs/$src"))
824+
end
825+
end
826+
end
827+
816828
@info "deploydocs"
817829
deploydocs(
818830
repo = "github.com/JuliaPlots/PlotDocs.jl.git",

docs/src/backends.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ For those who haven't had the pleasure of hacking on 15 different plotting APIs:
5050
However, you will probably have a hard time choosing the right backend for your task at hand.
5151
This document is meant to be a guide and introduction to make that choice.
5252

53+
# Persistent backend selection
54+
55+
Plots uses the [Preferences](https://github.com/JuliaPackaging/Preferences.jl) mechanism to make the default backend choice persistent across julia restart.
56+
57+
```julia
58+
$ JULIA_PKG_PRECOMPILE_AUTO=0 julia -e 'import Plots; Plots.set_default_backend!(:pythonplot)'
59+
$ julia # restart, show persistent mode
60+
julia> using Plots
61+
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
62+
[ Info: PythonPlot # precompiles for this backend
63+
julia> plot(1:2) |> display # uses `PythonPlot` by default
64+
```
65+
66+
You can clear preferences with `Plots.set_default_backend!()`.
67+
Alternatively, one can use the environment variable `PLOTS_DEFAULT_BACKEND` to select the default backend (but this will need to trigger manual precompilation using `Base.compilecache(Plots)`).
68+
5369
# At a glance
5470
5571
My favorites: `GR` for speed, `Plotly(JS)` for interactivity, `UnicodePlots` for REPL/SSH and `PythonPlot` otherwise.

0 commit comments

Comments
 (0)