Repository navigation
Convert axhline, axvline, and vertical/horizontal axline to layout shapes - #5719
robertoffmoura wants to merge 16 commits into
Conversation
camdecoster
left a comment
There was a problem hiding this comment.
Thanks for putting this together! There are a couple of issues to address, but it's an improvement. I left one suggestion about axis refs that isn't required, but it's worth looking at for this PR.
Could you please add a CHANGELOG entry?
| xref="x{0}".format(self.axis_ct), | ||
| yref="y{0}".format(self.axis_ct), |
There was a problem hiding this comment.
I updated the horizontal and vertical lines to use domain, but the diagonal ones are trickier. If we use domain for the diagonal lines, we'd get incorrect behaviour when panning or zooming in only one dimension. A workaround for the diagonal lines is to scale them by some factor (e.g. by 100). Not ideal, but I don't think Plotly supports infinite diagonal lines. Do you have any suggestions?
There was a problem hiding this comment.
That would likely cause issues with autoscale because it would try to fit those diagonal lines. I also wonder what would happen on log axes.
There was a problem hiding this comment.
It might be simpler to postpone support of diagonal lines to a later PR, and make this PR concerned only with support for axhline and axvline. What do you think?
There was a problem hiding this comment.
That seems fine. The rest of the fix looks good. Could you create a new issue for tracking that?
8535f8d to
f8bc3e8
Compare
|
Thanks! I added the changelog entry, addressed your suggestions, and left one comment regarding the zoom/pan issue for axline. |
b081e9a to
5b840bf
Compare
|
Rebased and resolved the merge conflicts. |
c16b645 to
7902257
Compare
861395e to
facee3c
Compare
|
Rebased and resolved the merge conflicts. Removed support for diagonal axlines temporarily (will re-add in another PR) |
|
Pushed 99077dc to fix |

mpl_to_plotlysilently drops reference lines.axhline,axvline, andaxlineproduce lines with blended or axes transforms, which the renderer skipped with "I found a line that didn't have 'data' coordinates! I will not draw it, but I did not crash.". The converted figure ends up with the reference lines missing completely.Fix: reference lines are now drawn as layout line shapes:
ax.transData.inverted()go.layout.Shape(type="line")on the current subplotBefore: 0 shapes (lines dropped with a warning).
After: lines render as layout shapes spanning the axis limits.
Snippet to reproduce: