Reputation: 1139
This code:
fig = go.Figure(data =
go.Contour(
z=[[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]]
))
fig.write_image("logs/test.png")
Produces this:
I would like only the main contour plot saved, with no x and y labels and no colorbar.
I expect that I could take a reliable sub-area of the image, but maybe there's an easier way?
Upvotes: 0
Views: 2753
Reputation: 61204
You can use:
fig.update_traces(showscale=False)
fig.update_layout(yaxis={'visible': False, 'showticklabels': False},
xaxis={'visible': False, 'showticklabels': False})
import plotly.graph_objects as go
fig = go.Figure(data =
go.Contour(
z=[[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]]
))
fig.update_traces(showscale=False)
fig.update_layout(yaxis={'visible': False, 'showticklabels': False},
xaxis={'visible': False, 'showticklabels': False})
fig.show()
fig.write_image("contour2.png")
Upvotes: 1