I want to know how to get a ggplot style background in Gadfly, including the grey color and the grids, etc.
An example:
# Can use Theme() or style()
ggplot_theme = Theme(panel_fill="gray90", grid_color="white")
# ggplot_theme = style(panel_fill=colorant"gray90", grid_color=colorant"white")
p = plot(x=1:5, y=rand(5), Geom.line, ggplot_theme)
If you want to use a Theme
that you’ve created on a number of plots, then do e.g. Gadfly.push_theme(ggplot_theme)
For more info, see http://gadflyjl.org/stable/man/themes.html
Thanks. How can I make the grid edge solid line instead of dot line?
It seems grid_strokedash
is missing from the docs, but type dump(Theme())
to see the full list.
And a new example:
using Colors, DataFrames, Gadfly, RDatasets
palette(n::Int) = LCHuv.(65, 100, 15:(360/n):374)
colscale = Scale.color_discrete(palette)
ggplot_theme = Theme(panel_fill="gray90", grid_color="white", grid_strokedash=[5mm, 0mm], discrete_color_scale=colscale)
p = plot(dataset("datasets","iris"), x=:PetalWidth, y=:SepalLength, color=:Species, Geom.point, ggplot_theme)
1 Like
That is exactly what I want!
@Mattriks the real Gadfly guru to the rescue. Awesome plot!