@@ -9,12 +9,14 @@ You can also reset your changes by calling `set_theme!()` without arguments.
99Let's create a plot with the default theme:
1010
1111``` @example 1
12- using GLMakie
12+ using CairoMakie
13+ CairoMakie.activate!() # hide
14+ AbstractPlotting.inline!(true) # hide
1315
1416function example_plot()
1517 f = Figure()
1618 for i in 1:2, j in 1:2
17- lines(f[i, j], cumsum(randn(1000 )))
19+ lines(f[i, j], cumsum(randn(50 )))
1820 end
1921 f
2022end
@@ -53,6 +55,21 @@ with_theme(fontsize_theme, fontsize = 25) do
5355end
5456```
5557
58+ ## Theming plot objects
59+
60+ You can theme plot objects by using their uppercase type names as a key in your theme.
61+
62+ ``` @example 1
63+ lines_theme = Theme(
64+ Lines = (
65+ linewidth = 4,
66+ linestyle = :dash,
67+ )
68+ )
69+
70+ with_theme(example_plot, lines_theme)
71+ ```
72+
5673## Theming layoutable objects
5774
5875Every Layoutable such as ` Axis ` , ` Legend ` , ` Colorbar ` , etc. can be themed by using its type name as a key in your theme.
@@ -75,6 +92,61 @@ ggplot_theme = Theme(
7592with_theme(example_plot, ggplot_theme)
7693```
7794
78- ### Special attributes
95+ ## Cycles
96+
97+ Makie supports a variety of options for cycling plot attributes automatically.
98+ For a plot object to use cycling, either its default theme or the currently active theme must have the ` cycle ` attribute set.
99+
100+ There are multiple ways to specify this attribute:
101+
102+ ``` julia
103+ # You can either make a list of symbols
104+ cycle = [:color , :marker ]
105+ # or map specific plot attributes to palette attributes
106+ cycle = [:linecolor => :color , :marker ]
107+ # you can also map multiple attributes that should receive
108+ # the same cycle attribute
109+ cycle = [[:linecolor , :markercolor ] => :color , :marker ]
110+ ```
111+
112+ ``` @example
113+ using CairoMakie
114+ CairoMakie.activate!() # hide
115+ AbstractPlotting.inline!(true) # hide
116+
117+ set_theme!() # hide
118+
119+ f = Figure(resolution = (800, 800))
120+
121+ Axis(f[1, 1], title = "Default cycle palette")
122+
123+ for i in 1:6
124+ density!(randn(50) .+ 2i)
125+ end
126+
127+ Axis(f[2, 1],
128+ title = "Custom cycle palette",
129+ palette = (patchcolor = [:red, :green, :blue, :yellow, :orange, :pink],))
130+
131+ for i in 1:6
132+ density!(randn(50) .+ 2i)
133+ end
134+
135+ set_theme!(Density = (cycle = [],))
136+
137+ Axis(f[3, 1], title = "No cycle")
138+
139+ for i in 1:6
140+ density!(randn(50) .+ 2i)
141+ end
142+
143+ set_theme!() # hide
144+
145+ f
146+ ```
147+
148+
149+
150+ ## Special attributes
79151
80152You can use the keys ` rowgap ` and ` colgap ` to change the default grid layout gaps.
0 commit comments