An internal Julia plotting package?

Check out VegaLite.jl, we’ve been using it on a current project to produce all of our figures and so far it has proven more than capable to accommodate a lot of very detailed twists and tweaks, certainly publication quality level. The core trick is to start with the VegaLite.jl docs, but then quickly move onto the original vega-lite docs which are very comprehensive. Plus, if VegaLite.jl is not flexible enough, one can always transition to Vega.jl, which has even more degrees of freedom (but is also more verbose).

6 Likes

In Matlab there is ONLY one plotting system so your example

I should be able to make my subplot 1 using Plots.jl, my subplot 2 using GMT.jl, my subplot 3 using Makie.jl, and so on.

would NOT be possible in Matlab. … but in Julia, yes. Just produce the individual figures in a raster format and make a mosaic of the subplots out of them. GMT.jl can do it and I’m (almost) sure the others as well.

3 Likes

In Matlab, I can make subplots using any external Matlab plotting toolboxes. Below is how I normally plot figures in Matlab:

handle = figure(1)
han01 = subplot(2,2,1)
   plot using whatever package
hand02 = subplot(2,2,2)
   plot using whatever package
han03 = subplot(2,2,3)
   plot using whatever package
hand04 = subplot(2,2,4)
   plot using whatever package.

For example, my geo-spatial subplots in Matlab are usually plotted using M_maps, which is an external mapping toolbox created by someone outside Mathworks.

Have a look at the M_maps source code. Is calls the Matlab (Java) functions to do the plotting. There is absolutely no way out of this (well, excluding some adventures in calling OpenGL directly). Believe me, I have deep experience with the Matlab plotting system and Mirone is a tool that I dreamed to port to Julia but nothing convenient for that has appeared yet.

4 Likes

That will be down to preference and use cases. But check this out Beautiful Makie Gallery

4 Likes

This related thread suggests that the claim is largely false.

1 Like

Edit:
It seems that @carstenbauer is in a good mood today :-).

Edit:
I just spotted my previous post was hidden by community flags. Just wanted to add that there was nothing personal nor there were any inappropriate intentions. I see the reason raised was “Your post was flagged as off-topic: the community feels it is not a good fit for the topic, as currently defined by the title and the first post.” I guess that’s possibly the same level of conversation as my interlocutor’s. Anyway, I was in a good mood and decided to express it publicly. Nothing else! :slight_smile:

Hi,

I think the best way to see it, is that matlab has a single plotting system.
All other packages, perform their plotting using that single system.

As was pointed out, in julia there is not one single plotting system, but many such as Plots.jl, Makie.jl, Gadfly.jl, Gaston.jl and many more.

The reason there is no single officially endorsed plotting system, was explained
by other people here in the thread.

In spite of this, some of those plottings systems offer ways to develop extensions for other packages.
Most notable example is Plots.jl which has a recipe system which allows third party packages to integrate their plotting with the Plots.jl system. This recipe system allows you to create combined figures using different packages and you should be able to make something like

han01 = subplot(2,2,1)
   plot using whatever package
hand02 = subplot(2,2,2)
   plot using whatever package
han03 = subplot(2,2,3)
   plot using whatever package
hand04 = subplot(2,2,4)
   plot using whatever package.

work within the Plots.jl recipe system as long as every “whatever package” complies with the recipe interface. You can have a look at this here.

I’m not sure but I think Makie.jl has similar recipe infrastructure. Unfortunately, these recipe systems are not necessarily compatible between each other.

I think people are working or will work in the future on making Make.jl recipes compatible with Plots.jl recipes.

I hope this helps
Olivier

1 Like

I don’t understand how Matlab is your counterexample to this. You can make decent plots in Matlab, but it takes tons of work. By comparison the defaults in Plots.jl are amazing. And the control capabilities are even better.

3 Likes

I kind of understand @leon point.
I use GMT.jl and Plots.jl. But it is hard, from my point of view, to make fast figures with either. My current workflow is to get some simple figures in Julia and then use GMT or Matlab to make my plots for my publication.

2 Likes

What are the features those have that are better? Looking at some examples they do not seem any easier (discounting the fact that one may be fluent with one and not the other).

The idea of building composed plots with different backends is interesting, and a package could do that, maybe Plots itself, as mentioned.

I don’t need (and actually don’t prefer) 3D plots, so there is not much that I miss in Plots+GR. There are small things that I would like to see improved, which are, as far as I can remember now: a) better integration with latex syntax in general, to allow diverse fonts + latex; b) easier layout handling; c) easier fine tuning of positions of annotations, labels, etc.

(b) and (c) get really easy with a GUI, in which one could move the elements on the plot and get the final coordinates. (This is the Origin advantage over all of these)

4 Likes

I do exactly the same thing!

I would think it is a great thing to design a Julia plotting framework / standard, so that Julia can handle the plot layout, and other plotting packages can fit in with the needed compatibility.

Alternatively, a package called something like PlotLayout.jl should be created to handle that. The issues is that it will be easier to ask the package developers to conform to the standards of Julia, instead of asking them to conform to the standards of another package.

GMT (and GMT.jl) is a lot more than just plotting. What is it that you can do easier in Maltlab than in GMT.jl? Honestly, I’m not question your answer, just want to know how things can be improved.

And BTW, though there is not GMT back-end to Plots, many of the plotting options are the same or similar.

Edit: Not counting volume rendering. There Matlab is far superior.

Hi @joa-quim not at all a complaint on the GMT or GMT.jl. We all know GMT is the master for geo-plotting and other types of postscript generation. Maybe it is the old me, but I still rather make my final figures in the standard version of GMT and use GMT.jl for quick figures…

I think the general workflow in Matlab for quick-and-dirty figures, in my opinion, is still the best:
e.g.

figure
subplot(2,1,1)
plot(x1,y1,'ok')
hold on
plot(x2,y2,'*r')
subplot(2,1,2)
pcolor(x_matrix,y_matrix,z_matriz)

Yes it would be great if there was one plotting system that can do everything, put that into Julia Base, then everybody can build packages off of that like in Matlab.

The problems:

  • build a plotting system first that can do everything (we’re trying in Makie but it’s hard, there’s soo much to do)
  • convince everyone that this one approach is the best (basically impossible)
  • finalize code so that it can be moved into Julia base, therefore no breaking changes are allowed anymore until julia 2.0 (also basically impossible because there’s such a huge surface of functionality, how do you know you’re done)

The path forward is that each plotting package does its best and we see how the user dynamics play out. Users will flock to the most useful, best maintained packages, and we can try to build bridges between the most used packages.

7 Likes

Maybe it is naive of me, but perhaps Julia needs something like BasicPlots.jl. Something that aids during the development of the code.

Not an advance package that can do everything as well and pretty as GMT.jl or Makie.jl. But instead (once again, taking the basic Matlab idea) a package that allow for quick-and-dirty plots. Something simple (with a fast learning curve) that does the very basic 1D and 2D plots (plots, heatmap/pcolor, contours), and maybe some basic 3D (plot3, surface) and some stats plots (histogram, boxplot). Perhaps with a simple layout command (subplot).

The rest can be achieved in the advance plotting package (@joa-quim knows that I will never stop using the GMT :joy:).

Just a thought.

The point, @marianoarnaiz, is that from my perspective your description is exactly what I want to achieve with GMT.jl. For example your subplot example is obtainable with something around (sorry, maybe later I can come with a clear working example)

subplot(grid="2x1")
    plot(x1,y1, marker=:circ, linewidth=0.5)
    plot!(x2,y2, marker=:star, mc=:red)
    pcolor(..., panel=(2,2))                 # EXCEPT THAT pcolor is not a GMT.jl module
subplot(:show)

But subplot is a harder target since there are so many things we may want to do/tune in a subplot figure and at same time make it simple to use. Matlab just choose awful bad defaults that everybody complains about (e.g. this ML package called “Plot it,…but plot it well! (MATLAB)”)

Anyway have a look at this subplot toy example.

1 Like

It seems that Makie is really the plotting package under the most active development currently. If there is a wish list, I would like to suggest a slightly better support for basic geo plots or if there already is such a support, some additional documentation on this topic.

What is the advantage of that relative to:

julia> using Plots

julia> plot(layout=(1,2))

julia> plot!(rand(10),subplot=1)

julia> heatmap!(rand(10,10),subplot=2)

? (serious question - meaning, what does that matlab workflow do that is so interesting? From the examples and code snippets I don’t get it)

2 Likes

The point is that Matlab handles layout from within, thus allowing subplots to be made from any external packages.

In your example, imagine you want to make subplot 1 using GMT.jl and subplot 2 using Makie.jl, and so on.

1 Like