Home > Enterprise >  Shared legend in subplots
Shared legend in subplots

Time:01-31

I'm trying to translate some of my R code to Julia. I mainly struggle with the difference in plotting as I'm very used to ggplot2.

There I can do:

mpg %>% 
ggplot(aes(x = displ, y = cyl, color = manufacturer))   
geom_point()   
facet_wrap(~class)

With this I get subplots, consistent x- and y-axes, a shared legend, and much more. How would I achieve this with Julia, say the GR backend?

CodePudding user response:

The easiest way to do this at present might be with enter image description here

There are a number of good examples and tutorials in https://makie.juliaplots.org/v0.15.1/tutorials/basic-tutorial/ and https://lazarusa.github.io/BeautifulMakie/

If you tend to like the "grammar of graphics" style, you might also check out AlgebraOfGraphics.jl, which is built on top of Makie, or (though I haven't tried it in some time) Gadfly.jl, which was actually one of the first plotting packages in Julia.

  •  Tags:  
  • Related