Hey,
I’m struggling with the distortion in the axis.
I found this “approach”:
But it’s couple of years old so I wondered whether there’s a solution without having to approximate…
Cheers!
Hey,
I’m struggling with the distortion in the axis.
I found this “approach”:
But it’s couple of years old so I wondered whether there’s a solution without having to approximate…
Cheers!
Hi @Vale1, you can fix the scaling by the use of scaleanchor
which is independent of the width
and height
of the figure.
here an MRE:
import numpy as np
import plotly.graph_objects as go
# Polar Coordinates
r = 1
theta = np.linspace(0, 2*np.pi, 200)
x_circle = 1 + r*np.cos(theta)
y_circle = 1 + r*np.sin(theta)
fig = go.Figure(
data=go.Scatter(
x=x_circle,
y=y_circle,
name='Circle',
mode='lines',
line=dict(
width=1.0,
color='rgba(66, 28, 82, 0.9)'
)
),
layout={'width': 500, 'height':400, 'xaxis': {'scaleanchor': 'y'}}
)
fig.show()
mrep scaleanchor
@AIMPED thank you very much, that’s amazing! Any chance you know whether there’s something similar for px.scatter figures?
You can update the layout:
fig.update_layout({'xaxis': {'scaleanchor': 'y'}})
@AIMPED thank you very much, it worked like a charm!