Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1095
previously in the matplotlib plots, we used the default behavior for text which is that matplotlib itself renders the text (the matplotlib output svg contains svg paths rather than text)
this is simple because then matplotlib knows the size taken by the text and can set the correct viewbox so we don't need any processing of the svg afterwards.
but the drawbacks are that:
the alternative, chosen in this PR, is to ask matplotlib to put the labels as text in the svg, in which case the application which displays it (in our case a web browser) is responsible for rendering it. the main drawback is that matplotlib does not know how much space the text will take, so we need to adjust the plot's viewbox and width and height with javascript after the page loads.
not directly related, but this pr also improves a bit how the text is truncated for right-to-left scripts, so that the ellipsis ("...") is displayed on the correct side of the text (in more cases). and it also normalizes whitespace so that we don't have line breaks in matplotlib labels
main
this PR
wider screenshots
main
this pr