Plots.jl: Color and width problems for contour line plots in plotly

Created on 1 Nov 2017  路  14Comments  路  Source: JuliaPlots/Plots.jl

Hi,
I'm having some problems plotting contour line plots (fill=false) using the GR backend.

MWE:

using Plots; gr()
Plots.contour(collect(1:100)*collect(1:100)', fill=true, c=:turbid)
Plots.contour!(collect(1:100)*collect(1:100)', fill=false, c=:gray, linewidth=10)

This gives:
image

This should first plot a filled contour using the turbid colorscale, then plot a line contour on top with the gray colorscale, with quite thick lines (w=10).
Instead the colorscale is only applied to the plot when fill=true, otherwise the colorscale request is ignored, and the default is used. Additionally the line width command is always ignored on these plots.
(The same behavior occurs when only a line plot is made; the combination plot here is just to contrast the working and aberrant behavior.)

Version info:
GR 0.24.0
Plots 0.13.1
Julia 0.6.1

Plotly bug

Most helpful comment

the level issue can only be fixed with a new contour fill routine - should be available with the next GR release ...

All 14 comments

It seems that there is another issue where levels attribute is also ignored when fill=true, but works when fill=false. It is always applied to the colorbar correctly though:

Plots.contour(collect(1:100)*collect(1:100)',fill=true,c=:turbid,levels=5)
image

This does appear to be a GR-related issue (@jheinen), though there are also bugs with the plotlyjs version (colorscale overlap and line widths)
skaermbillede 2017-11-01 kl 10 43 12

The pyplot version appears to do what you expect:
skaermbillede 2017-11-01 kl 10 53 23

Also tagging @daschw who is an expert on the colorbar functionality :-)

Hm, for me the example code on GR looks like this on master:
gr_contour_colors
So the colors issue should be fixed on master.
The contourf issue has already been reported in https://github.com/JuliaPlots/Plots.jl/issues/1024.
As you can see, with GR a gray colourbar is shown, which somehow makes sense, because the gray contour is plotted later. Although I think that in this case the :turbid colorbar looks nicer.

the linewidth in GR should be fixed by https://github.com/JuliaPlots/Plots.jl/pull/1221

It works for me on master now. Suddenly I doubt whether I remembered to check the GR version. Sweet fix, @daschw !

Let me redefine the issue.

Thx, what's your opinion on the colorbar color @mkborregaard (GR vs PyPlot)?

I think the plotly colorbar issue is a duplicate of #694

In this case PyPlot looks best, but generally I'd say it makes sense to show the colorbar for the latest plotted series?

There's also still this issue with GR:

It seems that there is another issue where levels attribute is also ignored when fill=true, but works when fill=false

This is turning into one of those intractable issues, where it's unclear how it can be closed and what backend it refers to...

In this case PyPlot looks best, but generally I'd say it makes sense to show the colorbar for the latest plotted series?

Agreed. So actually we should change the PyPlot behavior?
The problem is: I can't think of a way to get the (nicer) PyPlot result with the current GR implementation in this current test example.

I think that the levels issue has something to do with the fact that GR.surface is used for contourf. I played around a little but I have no idea how to fix this. I think we need @jheinen's superpowers here.

:pray:

the level issue can only be fixed with a new contour fill routine - should be available with the next GR release ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tbenst picture tbenst  路  3Comments

kersulis picture kersulis  路  5Comments

mkborregaard picture mkborregaard  路  3Comments

pkofod picture pkofod  路  3Comments

Cody-G picture Cody-G  路  4Comments