Plots.jl: Colors off in GR

Created on 27 Apr 2017  路  23Comments  路  Source: JuliaPlots/Plots.jl

The colors passed to GR appear to not be parsed correctly. MWE:

using Plots; gr(grid = false, ms = 150, legend = false, msw = 0)
scatter([1,2],[1,1], c =["#5fafaf", "#7aa6da"], ms = 150, ylim = [0,2], xlim = [0,3])

skaermbillede 2017-04-27 kl 12 10 19

pyplot(grid = false, ms = 150, legend = false, msw = 0)
scatter([1,2],[1,1], c =["#5fafaf", "#7aa6da"], ms = 150, ylim = [0,2], xlim = [0,3])

skaermbillede 2017-04-27 kl 12 11 20

Using an RGB color picker confirms that the colors are correct with pyplot.
@jheinen are you aware of this?

Most helpful comment

I'm currently out of office - but I'll try to fix this ASAP ...

All 23 comments

I'm currently out of office - but I'll try to fix this ASAP ...

Black is wrong too BTW.
I noticed this about a month ago, and I concluded it was an issue with the GR framework,
and I may have been a bad Open Source citizen and failed to make a bug report as I was busy.

image

Ms-Paint is telling me that the blacks in the top (gr) image is #00002D rather than the #000000 that was specified
PyPlot get it right, according to Ms-Paint

Really messes with you when you are trying to do color/perception related science with them.

The problem is fixed in https://github.com/jheinen/gr/commit/ae40c99eeb499e1909799ae1291727bd68a43321 . I will provide new GR run-time binaries tomorrow ...

That's amazing!

The new binaries (for GR master) are ready-to-install:

ENV["GRDIR"]=""
Pkg.build("GR")

This did solve the initial issue with the blue colors. But it didn't solve the black issue. Instead (in Juno), scatter([1,2],[1,1], c =["black", "#000000"], ms = 150, ylim = [0,2], xlim = [0,3]) resulted in two gray circles (rgb(68,68,68)), calling gui() to view in gksterm gave rgb(86,86,86)! Even more strangely, after calling the above twice, I tried to repeat the blue circles with scatter([1,2],[1,1], c =["#5fafaf", "#7aa6da"], ms = 150, ylim = [0,2], xlim = [0,3]) and got
skaermbillede 2017-04-28 kl 10 53 26

I can not reproduce the problem. Are you really using the GR master branch with the latest run-time (see previous post) ?

screen shot 2017-04-28 at 17 06 38

Yes:
skaermbillede 2017-04-29 kl 13 20 38
skaermbillede 2017-04-29 kl 13 20 56

versioninfo()
Julia Version 0.5.1
Commit 6445c82 (2017-03-05 13:25 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)

This is weird - I can't reproduce it.

I suspect there is a caching problem with the downloaded tar-file.
Could you please verify the libGR.so checksum?

using GR
libgr = joinpath(ENV["GRDIR"], "lib", "libGR.so")
println(readstring(pipeline(`sum $libgr`)))

The output should start with

48021 11164 ...

48021 11164 /Users/michael/.julia/v0.5/GR/src/../deps/gr/lib/libGR.so

No idea. I used a fresh Julia 0.5.1 installation with only 1 package (GR) installed. Could you please try this (GR-only) scenario:

using GR
setmarkersize(20)
setmarkertype(-21)
setmarkercolorind(Int(inqcolorfromrgb(0.373, 0.686, 0.686)))
polymarker([0.25], [0.5])
setmarkercolorind(Int(inqcolorfromrgb(0.478, 0.650, 0.855)))
polymarker([0.75], [0.5])

That appears to work as expected - using the colors Int(inqcolorfromrgb(0, 0, 0)) also creates the expected complete black. Plots/GR integration issue? I am on Plots master.

@oxinabox can you try

Pkg.checkout("GR")
ENV["GRDIR"]=""
Pkg.build("GR")

and then recreate your issue? It'd be good to know if this is only on my system.

Here is what I get, when I try to plot the above example:
(I am on Plots and GR master and I did

Pkg.checkout("GR")
ENV["GRDIR"]=""
Pkg.build("GR")

When I plot for the first time in Juno I get this:
gr_black_juno_screenshot1

However, saving this file changes the colors to grey:
gr_black_juno

Plotting the same Plot twice also turns the colors to grey:
gr_black_juno_screenshot2

If I do this in the julia REPL the same thing happens
1st plot command: black colors
saving as png: grey colors
2nd plot command: grey colors

This is not only happening with black:
1st plot in Juno:
gr_blue_juno_screenshot1

Saved png:
gr_blue_juno

2nd plot in Juno:
gr_blue_juno_screenshot2

It seems like once a color has been used, it is turned to grey:
gr_1color_screenshot

gr_2colors_screenshot

Confirmed

From the REPL, however, you can add new series like

using Plots
plot(rand(10))
plot!(rand(10))

without modifying the existing series color.
In Juno this would turn the existing series color to grey like in the screenshots above.
In both cases saved images are all grey.

There was still a stupid bug, but the problem(s) should be fixed with the latest run-time:

ENV["GRDIR"]=""
Pkg.build("GR")

Perfect - that worked! :-)

@daschw by the way - how do you get that nice projects panel to show in Juno?

Yep, now it works again for me!

@mkborregaard in the menu bar: View->Toggle Tree View

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pkofod picture pkofod  路  3Comments

cortner picture cortner  路  4Comments

mkborregaard picture mkborregaard  路  3Comments

asinghvi17 picture asinghvi17  路  3Comments

tbenst picture tbenst  路  3Comments