Here is an example of a pcolormesh:
<code>import numpy as np
import matplotlib.pyplot as plt
from bokeh.models import ColumnDataSource, Patches
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.palettes import plasma
import random
xpts = np.array([0, 0, 1, 1])
ypts = np.array([0, 1, 1, 0])
# Range of axes
nx = 1000
ny = 500
# "values"
colors = plasma(24)
source = ColumnDataSource(data=dict(
xs=np.array([(xpts+j) for i in range(ny) for j in range(nx)]),
ys=np.array([ypts+i for i in range(ny) for j in range(nx)]),
colors=np.array([random.choice(colors) for i in range(nx*ny)])
))
mpl_fig,ax = plt.subplots()
zz = np.random.rand(ny,nx)
ax.pcolormesh(zz)
plt.title("Test set")
ax.set_xlabel(r'time / UTC', fontsize = 12)
ax.set_ylabel(r'Altitude / m', fontsize = 12)
plt.show(mpl_fig)
</code>
<code>import numpy as np
import matplotlib.pyplot as plt
from bokeh.models import ColumnDataSource, Patches
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.palettes import plasma
import random
xpts = np.array([0, 0, 1, 1])
ypts = np.array([0, 1, 1, 0])
# Range of axes
nx = 1000
ny = 500
# "values"
colors = plasma(24)
source = ColumnDataSource(data=dict(
xs=np.array([(xpts+j) for i in range(ny) for j in range(nx)]),
ys=np.array([ypts+i for i in range(ny) for j in range(nx)]),
colors=np.array([random.choice(colors) for i in range(nx*ny)])
))
mpl_fig,ax = plt.subplots()
zz = np.random.rand(ny,nx)
ax.pcolormesh(zz)
plt.title("Test set")
ax.set_xlabel(r'time / UTC', fontsize = 12)
ax.set_ylabel(r'Altitude / m', fontsize = 12)
plt.show(mpl_fig)
</code>
import numpy as np
import matplotlib.pyplot as plt
from bokeh.models import ColumnDataSource, Patches
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.palettes import plasma
import random
xpts = np.array([0, 0, 1, 1])
ypts = np.array([0, 1, 1, 0])
# Range of axes
nx = 1000
ny = 500
# "values"
colors = plasma(24)
source = ColumnDataSource(data=dict(
xs=np.array([(xpts+j) for i in range(ny) for j in range(nx)]),
ys=np.array([ypts+i for i in range(ny) for j in range(nx)]),
colors=np.array([random.choice(colors) for i in range(nx*ny)])
))
mpl_fig,ax = plt.subplots()
zz = np.random.rand(ny,nx)
ax.pcolormesh(zz)
plt.title("Test set")
ax.set_xlabel(r'time / UTC', fontsize = 12)
ax.set_ylabel(r'Altitude / m', fontsize = 12)
plt.show(mpl_fig)
First question:
Why is the mesh not shown in plasma color palette as I think I passed it to do so?
Second question:
Can I add Bokeh tools to interactively work with the resulting plot? And how would I do that?
(I know hvplot.quadmesh but then colors appear pale)