Convert axhline, axvline, and axline to layout shapes - #5719
robertoffmoura wants to merge 13 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?
8535f8d to
f8bc3e8
Compare
|
Thanks! I added the changelog entry, addressed your suggestions, and left one comment regarding the zoom/pan issue for axline. |

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: