I'm trying to customize some subplots, but I don't understand what the axis 'anchor' attribute means.
Some examples where this attribute is used are here: https://plot.ly/javascript/subplots/ . What does yaxis2: {anchor: 'x2'}
mean? What does anchor=false
, or anchor=free
mean? I haven't been able to find an explanation in the online docs.
An x axis can be anchored to a y axis, for example xaxis2: {anchor: 'y2'} means that xaxis2 joins yaxis2 at the origin. If anchor is set to free , the position attribute can then be used to move the axis at another position.
How do you remove gridlines in Plotly? Toggling Axis grid lines Axis grid lines can be disabled by setting the showgrid property to False for the x and/or y axis.
Although the anchor mechanism is quite simple, seeing a schema from the start would have saved me a lot of time.
So here's a visual explanation of how subplot axes can be handled in 2D. Each pointed arrow represents an "is anchored to" relationship
Sketch based on the official example.
To answer my own question, I found the documentation on the axis anchor
attribute here.
An x axis can be anchored to a y axis, for example xaxis2: {anchor: 'y2'}
means that xaxis2 joins yaxis2 at the origin. If anchor
is set to free
, the position attribute can then be used to move the axis at another position.
I'm not sure whether setting anchor=false
is even possible, I saw that used in the make_subplots
function of the plotly.py API here, but it may be that false
is just a value used by the python API internally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With