Assuming I have a data for different levels and I want to plot it as different vertical sections of a contour plot.
I may also need to do it with different datasets, for instance, plotting a volume plot and below it, its gradient, or the error, as a vertical section of a contour plot with a different colormap.
How can I do it using the Python package for Plotly? I couldn't find this type of plot in their examples.
I kind of found a way to do it, but it works like a pcolor
instead of contour
. To do that, I have to plot a surface with fixed depth and use the attribute surfacecolor
to define the color array.
fig = go.Figure(data=[
go.Surface(
x=x,
y=y,
z=z1,
colorbar=dict(len=0.3, x=0.8, y=0.75),
),
go.Surface(
x=x,
y=y,
z=z2*0-np.pi,
surfacecolor=z2,
opacity=0.5,
cmin=-1,
cmax=1,
colorscale='RdBu',
colorbar=dict(len=0.3, x=0.8, y=0.5),
),
go.Surface(
x=x,
y=z2*0+2*np.pi,
z=y-np.pi,
surfacecolor=z2,
opacity=0.5,
cmin=-1,
cmax=1,
colorscale='Spectral',
colorbar=dict(len=0.3, x=0.8, y=0.25),
),
])
fig.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.