0

In my Jupyter Notebook I am plotting various xarrays as pcolormeshs via the some_xa.plot() function. Now I want to plot them as a certain cmap, e.g. cmap = 'RdBu_r' instead of the default 'viridis', without passing this to every single call for a plot.

In other words: How can I set cmap = 'RdBu_r' as default for plotting xarrays in this Notebook?

I've tried to use the default of matplotlib:

plt.rcParams['figure.figsize'] = (20.0, 10.0) 
plt.rcParams['image.cmap'] = ('RdBu_r')

While the figure size is changed for all plots, the cmap isn't influenced at all and presents 'viridis' every time, except I enter a value that is not recognized, resulting in a ValueError.

Messor
  • 89
  • 6
  • Have you seen this topic? https://stackoverflow.com/questions/33185037/how-to-set-default-colormap-in-matplotlib – sander May 07 '20 at 07:51
  • @Sandertjuhh: just checked, but neither option did the job. Seems that `xarray.plot()` somehow overwrites the matplotlib defaults (?) – Messor May 07 '20 at 08:07

0 Answers0