I would like to use a brewer qualitative palette using plotnine, but I get the error:
ValueError: Invalid color map name 'Set1' for type 'Sequential'.
Valid names are: ['Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'OrRd', 'Oranges', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']
Reproducible example
from plotnine import *
import pandas as pd
df = pd.DataFrame({'a': [0,1,2,3,4], 'b': [0,-2,10,6,8], 'c': ['a', 'b', 'a', 'a', 'b']})
(ggplot(df, aes(x = 'a', y = 'b', color = 'factor(c)')) +
geom_line() +
scale_color_brewer(palette = 'Set1'))
In ggplot2 in R, however, you can do the same and get the correct plot
library(ggplot2)
df = data.frame(a = c(0,1,2,3,4), b = c(0,-2,10,6,8), c = c('a', 'b', 'a', 'a', 'b'))
ggplot(df, aes(x = a, y = b, color = factor(c))) +
geom_line() +
scale_color_brewer(palette = "Set1")
scale_color_brewer(palette = 'Blues'))
– OatValueError: Invalid color map name 'Set1' for type 'Sequential'
- ifscale_color_brewer()
expectsSequential
then forget about other values. – TrilobiteSequential
. Please see my edited question and added aggplot2
code that produces what I expected. – Phytogenesistype
argument as stated in ropensci.github.io/plotly/ggplot2/scale_brewer.html ? – Trilobite