-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Altered colours from subsequent use of a custom palette #701
Comments
If you want specific colors, just set the color directly (instead of match,
which is the default anyways). Palette determines the "family" of colors.
…On Thu, Feb 23, 2017 at 5:38 AM Antonello Lobianco ***@***.***> wrote:
Hello, when trying to plot multiple groups of series from a dataframe and
reuse the same colour palette for the individual series, the subsequent
series use an "altered" version of the colours:
using DataFrames, Plots, StatPlots
x = [110,120,130,140, 105,115,125,135]
df = DataFrame(
fruit = ["orange","orange","orange","orange","banana","banana","banana","banana"],
year = [2010,2011,2012,2013,2010,2011,2012,2013],
prod = x,
cons = x - 20,
exports = x - 40,
imports = x - 60,
)
plotlyjs() # same with pyplot() backend..
mycolors = [:red, :green ] # same with mycolors = [:yellow, :orange ]
fruits_plot = plot(df, :year, :prod, group=:fruit, linestyle = :solid, linewidth=3, linecolor=:match, color_palette = mycolors)
fruits_plot = plot!(df, :year, :cons, group=:fruit, linestyle = :dot, linewidth=3, linecolor=:match, color_palette = mycolors)
fruits_plot = plot!(df, :year, :exports, group=:fruit, linestyle = :dash, linewidth=3, linecolor=:match, color_palette = mycolors)
fruits_plot = plot!(df, :year, :imports, group=:fruit, linestyle = :dashdot, linewidth=3, linecolor=:match, color_palette = mycolors)
Results in:
[image: fruits_plot]
<https://cloud.githubusercontent.com/assets/2077159/23255513/3254220e-f9bc-11e6-9c95-c61933b7c8b4.png>
As you can see, the problem is that the subsequent groups of series use
the palette with somehow "distorted" (or sometimes inverted) colours.
This is independent from the specific backend used.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#701>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA492tA9Gr29uF0-VOa45YiuEazhh6iEks5rfWGYgaJpZM4MJzao>
.
|
In the documentation it is stated that:
This is what I want, as I am using it for a group of series, not for an individual one (and I am using the keywork Bdw, I did try to set |
Use a 1x2 matrix when setting colors for 2 series
…On Thu, Feb 23, 2017 at 7:02 AM Antonello Lobianco ***@***.***> wrote:
In the documentation <https://juliaplots.github.io/colors/> it is stated
that:
color_palette determines the colors assigned when seriescolor == :auto:
If passed a vector of colors, it will force cycling of those colors
This is what I want, as I am using it for a *group* of series, not for an
individual one (an I am using the keywork group)
In fact, it works well on the first usage. The problem is when I add to
the same plot other group of series.
Bdw, I did try to set linecolor directly, but it accepts only a scalar,
not arrays..
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#701 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA492ldV0hYe4ipYIylorKsJb7gLRhuwks5rfXVagaJpZM4MJzao>
.
|
yep, using |
Hello, when trying to plot multiple groups of series from a dataframe and reuse the same colour palette for the individual series, the subsequent series use an "altered" version of the colours:
Results in:
As you can see, the problem is that the subsequent groups of series use the palette with somehow "distorted" (or sometimes inverted) colours.
This is independent from the specific backend used.
The text was updated successfully, but these errors were encountered: