Tuesday, 24 October 2023

plotnine change default colormap

Is there a way to change the default colormap in plotnine to a custom colormap? I like to avoid adding something like + scale_color_manual(custom_palette) to all my ggplot figures.

I know how to change the theme for the plotnine figures with theme_set(), but is there also something equivalent like scale_set(), since scale define the colors in plotnine.

The same applies for changing the datetick format for the x axis when your data has a time index. Is there a global way to set it instead of using scale_x_datetime(breaks=date_breaks('5 years'), labels=date_format('%Y'))

In other words, I am looking for something that is equivalent to

import matplotlib.pyplot as plt
plt.style.use('ggplot')

in Matplotlib.



from plotnine change default colormap

No comments:

Post a Comment