What is the status of the Plots ecosystem and what package should I use?

I am coming from a ggplot2 background and would like to completely switch my workflow to Julia. What is the status of plotting in Julia? Is gadfly still viable, is vegalite hooked in with Plots.jl yet?

1 Like

Do give VegaLite.jl a try! It is a pretty comprehensive grammar of graphics implementation, so if you are coming from ggplot2, it should feel fairly familiar. All the house keeping things (plots show properly on all platforms and clients, you can export into lots of formats etc.) should just work. It also has pretty good load times. You also get integration with DataVoyager.jl, which makes for nice data exploration. And the underlying vega-lite is really well documented, which in combination with the VegaLite.jl documentation gives you a lot of material. And finally you can use any of the about 20 table types that integrate with TableTraits.jl (all listed here) as your data source, not just DataFrame. And I would be especially interested in feedback from folks that have extensive ggplot2 experience, so any thoughts you have on the package, I’d love to hear!

There are no plans to hook VegaLite.jl up with Plots.jl. In my mind the main appeal of something like VegaLite.jl is that it does the kind of ggplot2 story really well and has an API in that spirit, and I think it does so best by just being an independent package.

I believe Gadfly.jl is still very viable as well, but I’ll let someone else who knows it better talk about it. My sense is that it is being actively developed, and in no way stale.

I think in terms of stable packages that have a ggplot2 like interface, those are currently your two best options.

4 Likes

I will echo what David said in that VegaLite and Gadfly are your two best options for grammar of graphics plotting in Julia, like you know it from ggplot2. I think of Gadfly as “stable and well-maintained” rather than “very actively developed” but that should only be an advantage for most users. I also agree that the strength of VegaLite is it’s GOG-interface and thus it is not obvious it would be an advantage to combine it with Plots.

For your other question, the status of the Plots ecosystem is good and stable, it permeates many of Julia’s packages and many find it enjoyable to use. Plots doesn’t use a grammar-of-graphics interface, but it does use a nice terse syntax that in my opinion is way better than e.g. that of base R. I’d encourage you to try it too.

To my mind, the main difference among the systems is that Plots is very focused on creating automatic plotting dispatch on user (and package) custom types (such as phylogenies, shapefiles, differential equation fits, etc.), making it a very Julian plotting package. Whereas the GOG packages focus on plotting data in DataFrames/tables. The lines aren’t sharp, in that e.g. Gadfly can also dispatch on user types if you write the functionality.

Finally, if you like the real bleeding edge, there’s an all new package StatsMakie that aims to add a GOG-interface on top of the new plotting package Makie. It has an unconventional syntax, but worth trying out.

4 Likes

Obviously David’s and Michael’s suggestions are very good (Gadfly is already a few years old and therefore quite polished, VegaLite.jl builds on top of the excellent and mature VegaLite javascript library and Plots, despite not implementing grammar of graphics, is widely used and provides a friendly and Julian syntax).

For those who feel adventurous, I think StatsMakie (a hybrid approach, adding ideas from Grammar of Graphics to Makie) is already at a point where people can play with it (it’s far from being perfect and many things remain to be done). I wrote small tutorial for those who are interested. It’s probably a bit early to use StatsMakie for publication quality graphs but it’s a very good time to give feedback!

4 Likes

I also came from a ggplot background and when I did the switch to Julia I just used PlotlyJS directly. It has a rich interface and quite mature in my opinion. It works really well for me. :blush: I really enjoy using Makie as well for more advanced plotting.

1 Like

How do these packages compare as regards time to first plot?

I should try all of these for myself, of course, but perhaps someone knows the summary… This is really my main hurdle with using Plots; gr() which otherwise seems fine for making plots of things I’m calculating. (Neither lots of polish nor huge data for now.)

Yes none of us meant to imply that what we mentioned are the only good or viable plotting packages. He was explicitly asking about VegaLite, Gadfly and Plots. There are lots of alternatives, GR on it’s own, PGFPlotsX, InspectDR, PyPlot, Winston etc.

About time-to-first-plot, I believe GR (without Plots) should be a clear winner. The reason being that it’s written in C, so it’s a fully statically compiled binary.

1 Like

The JavaScript options (PlotlyJS.jl and VegaLite.jl) would probably be the next fastest in terms of time to first plot. But I haven’t properly measured it.

PyPlot.jl should also be mentioned!

I should publish my hackathon solution (based on PackageCompiler.jl) from JuliaCon 2019 which reduces time-to-first-plot for Plots+GR by to one tenth and improves the drawing speed considerably.

1 Like

which one is it? I hope it’s to

1 Like

Can Vega or VegaLite be used to layer multiple charts. I’m trying to do economics, so I want to layer contours, to find tangents.

Yes, VegaLite.jl supports layered plots. Essentially it works like this:

using VegaLite

data |> @vlplot(x=:colA) + @vlplot(:point, y=:colB) + @vlplot(:line, :colC)

The first call to @vlplot sets joint properties for all layers, and then each additional @vlplot adds a layer.

1 Like