Hi everyone! First one, I’d like to figure out is it possible to overlay grid over contour graph (problem illustrated on the first attached image). And second one, when I set Histogram2dContour.contours.coloring=‘none’ I can disable contour graph using legend (second attached image) and with other values I can’t do this (there is no trace0 on the first attached image’s legend). Is it possible to dissable contour graph using ‘heatmap’, ‘lines’ or ‘fill’ values of coloring parameter?
Overall I want to use Histogram2dContour.contours.coloring=‘heatmap’ with ability to dissable contour graph using legend and grid which overlaying contour graph
Any help is highly appreciated.
import plotly.offline as ply
import plotly.graph_objects as go
import numpy as np
x, y = np.random.normal(0, 1, 10000), np.random.normal(0, 1, 10000)
fig = go.Figure()
fig.add_trace(go.Histogram2dContour(
x=x,
y=y,
colorscale = [[0, 'rgb(155,155,155)'], [1, 'rgb(0,0,0)']],
xaxis='x',
yaxis='y',
ncontours=10,
line=dict(width=1),
showscale=False,
contours=dict(#coloring='heatmap',
coloring='none',
showlabels=True,
labelfont=dict(size=18)
)
))
fig.add_trace(go.Scatter(
x=x,
y=y,
xaxis='x',
yaxis='y',
mode='markers',
marker=dict(size=2)
))
fig.add_trace(go.Histogram(
y=y,
xaxis='x2',
))
fig.add_trace(go.Histogram(
x=x,
yaxis='y2',
))
fig['layout']['yaxis'].range = [-5, 5]
fig['layout']['xaxis'].range = [-5, 5]
fig.update_layout(
paper_bgcolor="White",
template="plotly_white",
autosize=True,
xaxis=dict(
zeroline=False,
domain=[0,0.85],
showgrid=True
),
yaxis=dict(
zeroline=False,
domain=[0,0.85],
showgrid=True
),
xaxis2=dict(
zeroline=False,
domain=[0.9,1],
showgrid=False,
),
yaxis2=dict(
zeroline=False,
domain=[0.9,1],
showgrid=False
),
height=900,
width=900,
bargap=0,
hovermode='closest',
showlegend=True
)
ply.plot(fig)