-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Labels
Description
Description
When supplying my own colors and unevenly spaced levels explicitly, I observe an unexpected behavior where some colors are omitted and others are repeated.
Steps to reproduce
import proplot as pplt
import numpy as np
N=20
state=np.random.RandomState(51423)
data=np.cumsum(state.rand(N, N), axis=1)
colors=['white','indigo1','indigo3','indigo5','indigo7','indigo9','yellow1','yellow3','yellow5','yellow7','yellow9','violet1','violet3']
fig,axs=pplt.subplots(nrows=2, ncols=1, refheight=3.5)
axs[0].pcolormesh(data, levels=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
colors=colors, colorbar='r', extend='both', colorbar_kw={'label':'Expected color distribution'})
axs[1].pcolormesh(data,levels=[1., 1.25, 1.5, 2., 2.5, 3., 3.75, 4.5, 6., 7.5, 9., 12.],
colors=colors, colorbar='r', extend='both', colorbar_kw={'label':'Unexpected color distribution'})
Expected behavior: I expected that all 13 named colors would still show when mapped to the unevenly spaced levels on axs[1]
.
Actual behavior: In this example on axs[1]
, some colors are omitted and replaced by others. I also observe this issue when providing my own RGB tuples.
Equivalent steps in matplotlib
Explicitly providing named colors and unevenly spaced levels in Matplotlib gives the desired behavior.
Proplot version
ProPlot 0.9.5
Matplotlib 3.4.3
Python 3.9.7