Skip to content

Commit bf8a84c

Browse files
authored
prepare StableRNGs (#327)
1 parent 43d80b8 commit bf8a84c

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1111
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
1212
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
1313
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
14+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
15+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
2727
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
2828
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
2929
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
30+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
3031
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
3132
RecipesPipeline = "01d81517-befc-4cb6-b9ec-a95719d0359c"
3233
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
34+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
3335
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
3436
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
3537
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

src/PlotDocs.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module PlotDocs
22

3-
using Plots, DataFrames, MacroTools, OrderedCollections, Dates
4-
import Plots: _examples
3+
using Plots, DataFrames, MacroTools, OrderedCollections, Dates, StableRNGs
4+
import Plots: _examples, PLOTS_SEED
55
using JSON
66

7+
import Random
8+
79
export
810
generate_cards,
911
generate_supported_markdown,
@@ -79,7 +81,10 @@ function generate_cards(pkgname::Symbol; skip = get(Plots._backend_skips, pkgnam
7981
end
8082
# DemoCards use Literate.jl syntax with extra leading `#` as markdown lines
8183
write(jl, "# $(replace(example.desc, "\n" => "\n # "))\n")
84+
write(jl, "using StableRNGs #hide\n")
85+
write(jl, "rng = StableRNG($PLOTS_SEED) #hide\n")
8286
isnothing(example.imports) || pretty_print_expr(jl, example.imports)
87+
# pretty_print_expr(jl, Plots.replace_rand(example.exprs))
8388
pretty_print_expr(jl, example.exprs)
8489

8590
# NOTE: the supported `Literate.jl` syntax is `#src` and `#hide` NOT `# src` !!
@@ -90,7 +95,7 @@ function generate_cards(pkgname::Symbol; skip = get(Plots._backend_skips, pkgnam
9095
"png(\"assets/$(pkgname)_ex$i.png\") #src\n"
9196
end)
9297
if pkgname === :plotlyjs
93-
write(jl, "nothing#hide\n")
98+
write(jl, "nothing #hide\n")
9499
write(jl, "# ![plot](assets/$(pkgname)_ex$i.png)\n")
95100
end
96101

0 commit comments

Comments
 (0)