Skip to content

Commit

Permalink
doc: Example with Plots.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
musoke committed May 30, 2024
1 parent 62e44bc commit 31bc42c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProudPalettes = "61d02e3d-8de9-45ce-a87b-73174b99cb55"

[compat]
Expand Down
5 changes: 4 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ makedocs(;
edit_link = "main",
assets = String[],
),
pages = ["Home" => "index.md", "Examples" => Any["Makie.jl"=>"examples/makie.md"]],
pages = [
"Home" => "index.md",
"Examples" => Any["Makie.jl"=>"examples/makie.md", "Plots.jl"=>"examples/plots.md"],
],
)

deploydocs(; repo = "github.com/musoke/ProudPalettes.jl", devbranch = "main")
26 changes: 26 additions & 0 deletions docs/src/examples/plots.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# # Use with Plots.jl

using Plots
using ProudPalettes

# The palettes defined in [`PROUD_PALETTES`](@ref) can be used to set colors in
# [Plots.jl](https://github.com/JuliaPlots/Plots.jl) plots.
#
# For example,

x = 0:1e-2:2π
plot(x, cos, color = PROUD_PALETTES[:rainbow][1])
plot!(x, sin, color = PROUD_PALETTES[:rainbow][2])

# They can also be used to set the palette for a whole plot.
# This can be simpler than setting colors one plot at a time.

palette = PROUD_PALETTES[:rainbow]
p = plot(palette = palette)

for (i, _) in enumerate(palette)
y = @. sin(x) + i - 1
plot!(x, y, ribbon = 0.4)
end

p

0 comments on commit 31bc42c

Please sign in to comment.