Open joshjob42 opened 10 years ago
There is a Scale.discrete_color_manual
that may help.
colors = linspace(convert(LCHuv, color("orange")),
convert(LCHuv, color("sky blue")), 8)
plot(x=rand(102), y=rand(100),
color=[["A", "B", "C", "D", "E", "F"][i] for i in rand(1:6, 100)],
Scale.discrete_color_manual(colors...),
Geom.line)
If Julia plays a major role in you analysis, it would be good to cite it. There is a julia paper. You don't need to cite Gadfly, but it'd appreciated if you do. I'm going to get a DOI for the repository that will let you do that. See #438
And that color scale was a silly example. If you want something like ggplot2's default:
colors = linspace(LCHuv(70, 70, 0), LCHuv(70, 70, 315), 8)
Is there any way of finding what colors are used in the default continuous color scale? I.e. when I say "plot(df, x=:x, y=:y, color=:A)" can I find out what colors are actually used in the resulting plot?
It's not necessarily something I had in mind, but you can do this:
colors = [Scale.continuous_color().f(p) for p in linspace(0, 1, 6)]
Scale.continuous_color().f(p)
constructs a default continuous color scale and calls it's color generating function f
, which takes a value in [0, 1] and returns a color. linspace(0, 1, 6)
generates 6 such numbers. So just replace 6 with however many colors you actually need.
I'm seeing colors that are significantly lighter in hue than the actual continuous plot.
I followed your last post's strategy. The colors look right, they're just too light.
The odd thing is if I call "Scale.continuous_color()" instead of "Scale.discrete_color_manual(colors...)" I recover the darker colors, yet when I'm seemingly plotting the same colors using discrete labels they are lighter. Any idea for the cause (and a potential cure)?
I'm preparing a set of figures for a paper using Gadfly. I'm not sure if one is supposed to reference things like this (either Julia or particular packages like Gadfly). Do you happen to know?
In any case, the figures are all quite beautiful except for one issue. I have plots with multiple curves, each curve is a different color which corresponds to the value of some parameter. If I plot it with a continuous color scale, the plot is quite attractive to the eye as the curves form a sort of rainbow. However, I would very much like each curve to have it's own entry in the legend so that one can trivially compare and precisely pinpoint the value of the parameter corresponding to each curve. Scale.discrete_color's color choice is quite unattractive to me however.
Is there any way to change the colors used when you use Scale.discrete_color to be the same as in the continuous case?