Why Plots.jl produce figures looks not as good as other packages even with pyplot

Add in 21.Jan.
people are trying to tell me the style can be customized, but no one explains why the default style is not pretty at all.

And if you think the default is pretty just say it’s pretty. Don’t tell me that it can be customized, because customization doesn’t conflict with pretty default plotting.


Just look at one example in matplotlib, I produced in julia. Why did the developers choose to make the default figure like this?
I mean, the one from matplotlib looks much better for publication, right?

image
image

I think it’s somewhat subjective. I myself don’t prefer Plots.jl nor pyplot but use Gnuplot.jl for all my plotting (plus it’s really powerful with a lot of features and basically no FTTP issue).

To answer your question directly, perhaps within Plots.jl there could be user-specific defaults setup (so in your case for example, the mirrored axis will go away).

2 Likes

They do have the user-specified default setup. However, it takes some effort to find what are the keywords and what is the effect of each keywords.

But I took a look at the syntax of Gnuplot.jl and found Plots.jl is more user-friendly as i don’t have any experience of Gnuplot

It took me a while to get the basics (and I still mostly have to google it). There is a Julia friend wrapper around Gnuplot (check out Home · Gaston.jl (mbaz.github.io) but as far as I know, it still dosn’t hook into the Plots.jl interface.

Don’t let me derail the conversation. Perhaps someone from Plots.jl can provide a comment on why certain defaults were chosen.

Matplotlib main advantage in your example is that it automatically places the legend away from the data. Plots.jl could default to place the legend outside the plot area.

Plots.jl’s default discrete light gray grid lines in the background are very useful to make the values easier to read. For example, we know that the quadratic reads 4 at x=2.

1 Like

I really want to know why some features are chosen. In the presented example, I think adding box=:off , grid=:off, legend=:topleft, background_color_legend=nothing makes the figure looks slightly better. But I think the thing makes the figure of matplotlib more elegant is maybe the transparent background of legend and the font size.
image

The choice of having the gridlines or not is a personal preference. Figure with gridlines can be good looking, but Plots.jl clearly doesn’t provide.

I mean this is all just personal preference, isn’t it? Not much point arguing over it, just set your default()s as you like (or via your startup.jl)

5 Likes

Yes, most of the things are personal preference, I fully agree. Also the choice of plotting library is quite a controversially topic in the Julia community. You ask 10 people and get 15 different answers :wink: I love and prefer PGFPlotsX.jl because that’s in my opinion the most mature and best documented feature-rich plotting library which produces publication-quality graphics (TeX). But as written above, whatever you like :wink:

However, regarding the colours, there is one important thing: there are many colour blind people, so choose colours which are distinctive for the majority of the people.

Luckily, the default colours nowadays are pretty good, see below (if you don’t see a difference, you probably have deuteranomaly), the examples created with Coblis — Color Blindness Simulator – Colblindor

original
deuteranomaly

2 Likes

some are personal preferences, some are not. A simple question, do you prefer to use the figure with default setting from Plots.jl for publication?

Why would you use the defaults for publication? That’s a straw man you’re building for a fight nobody is trying to have.

I like Plots, specifically because it’s very configurable. Personally, I almost always do

default(;seriestype=:scatter, fontfamily="Computer Modern", label=nothing)

at the start of a script. If it’s important, I will also spend a little time choosing a good color scheme for my specific use case. But I’m not pretentious enough to think everyone shares my preferences.

The defaults are fine and the options are numerous.

8 Likes

I’d frequently used Plots.jl with the PGFPlots backend to produce figure with publication quality far superior to what matplotlib produces. You can use matplotlib2tikz for similar output, but matplotlib doesn’t really produce close to publication-quality figures out of the box in my opinion.

4 Likes

I am surprised there are people defending the default plotting style.

Not why, just why not have the default plots that look like something is for publication.

Hope you can understand that a better default look doesn’t conflict with numerous options and configurability.

But my point is that the default plot from Plots.jl clearly doesn’t look like something for publication.
I cannot even put the default plot figures for the presentation to my supervisor. But I can accept to put the figure from matplotlib in the slides to my supervisor.

1 Like

I agree with some points - eg the legend autoplacement in Plots.jl can indeed be improved to avoid lines. But at least some of those differences are definitely a matter of preferences. For example I always put grids on my plots, and have the corresponding option set in matplotlib config.

3 Likes

5 posts were split to a new topic: Making Plots place its legend in a better spot (with GR)

In any case, many Plots.jl’s defaults are quite good and output nicely in *.svg or *.pdf formats, for instance:

using Plots
plot(atanh ∘ cos ∘ abs2, label="atanh(cos(x²))")
savefig("Plots_gr_default.pdf")

The fact is that the diversity of possible inputs is so great that it is probably difficult to optimize it in all cases and for quality publications we have to adapt to the dataset in hand. Probably the defaults are defined for quick display (no oversampling done for functions input as above, etc.)

If you like matplotlib and its defaults, why don’t you just use PyPlot.jl instead of Plots.jl?

9 Likes

I’m not sure the question can be answered in a meaningful way. Your preferences are likely different than mine which are different than the next person. The authors of the plotting packages get to decide what the defaults are - I think that is reasonable.

1 Like

So do you mean the default plotting of Plots.jl is better than matplotlib?