Python: смещенная логарифмическая цветовая полоса, белый цвет смещен к центру. ⇐ Python
Python: смещенная логарифмическая цветовая полоса, белый цвет смещен к центру.
I am struggling to plot my data using pyplot.imshow. I use the 'RdBu_r' colormap, and I need the white color to be at value 1 on a logarithmic scale which is not centered at 1. But how can I do it? I tried 'center=1' which works for seaborn, but there is no such attribute in matplotlib. I also tried this:
import matplotlib.pyplot as plt im=plt.imshow(proportion, cmap="RdBu_r", norm=LogNorm(), vmin=0.01, vmax=10) axs=plt.gca() cb = plt.colorbar(im, ax=axs,extend="both") where proportion is my data array, ranging from 0.01 to 10. However there seems to be no way to specify that the white should be at 1 on this scale. Is there a way to do that?
Note again that I need to make use a gradient of colors here and a logarithmic normalization.
Источник: https://stackoverflow.com/questions/486 ... -to-center
I am struggling to plot my data using pyplot.imshow. I use the 'RdBu_r' colormap, and I need the white color to be at value 1 on a logarithmic scale which is not centered at 1. But how can I do it? I tried 'center=1' which works for seaborn, but there is no such attribute in matplotlib. I also tried this:
import matplotlib.pyplot as plt im=plt.imshow(proportion, cmap="RdBu_r", norm=LogNorm(), vmin=0.01, vmax=10) axs=plt.gca() cb = plt.colorbar(im, ax=axs,extend="both") where proportion is my data array, ranging from 0.01 to 10. However there seems to be no way to specify that the white should be at 1 on this scale. Is there a way to do that?
Note again that I need to make use a gradient of colors here and a logarithmic normalization.
Источник: https://stackoverflow.com/questions/486 ... -to-center
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение