'Python Plotly tips on how to set Z-axis to logscale
Greetings fellow humans, What I wish to do is simply plot the 3d surface plots Z-scale (code below) as logarithmic scale. I've been looking at the official documentation for a bit now and I can't seem to find the "fig.update_xaxes(type="log")" equivalent for the Z scale. I've tried simply replacing the 1st 'x' with a 'z', but that resulted in an error: File "/path/to/file.py", line 18, in fig.update_zaxes(type="log") AttributeError: 'Figure' object has no attribute 'update_zaxes'
Does anyone perhaps have some advice? The surface plot in 3D looks good, but it would look better in log-scale.
import plotly.graph_objects as go
import pandas as pd
z_data = pd.read_csv('data.csv',index_col=False)
y = z_data['1']
z = z_data.iloc[:,1:]
fig = go.Figure(data=[go.Surface(z=z, y=y)])
fig.update_layout(title='3D plot', autosize=False,
width=1880, height=1080,
margin=dict(l=65, r=50, b=65, t=90))
#fig.update_zaxes(type="log")
fig.write_image("data.png")
fig.show()
Thank you to anyone trying to help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
