Open
Conversation
In matplotlib, an axis has three titles: default one, but also left and right ones (that's what `loc=` does). Export all three, if present. One design question here was whether to export left/right titles as "title" too for text_type, or as separate types. I checked, all existing exporters simply ignore the text_type argument, so there are no compatibility considerations. Then, I think more info is strictly better, and if one were ever to care about titles in general, one could still do `if "title" in text_type`.
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Jan 20, 2026
This adds or fixes support for the following matplotlib axis title (ax.set_title) features: - newlines: SVG `<text>` can't do that, need to use `<tspan>`s inside, see also [this SO q/a](https://stackoverflow.com/questions/16701522/how-to-linebreak-an-svg-text-within-javascript). - linespacing: naturally follows from wanting newlines. Needs exporter support, so PR mpld3/mplexporter#77 first. - left/right titles were completely missing; this adds support for those, which also needs exporter support, so this PR first: mpld3/mplexporter#78 - The `malign` property, which defines in the multi-line case, how the text lines should be aligned (all left, all center, all right). I made this with major help from gpt-codex-5.2, although in the end I went over all of its code and did a little simplifications here and there, needed multiple iterations overall.
Member
|
Hey @lucasb-eyer, just checking in to say that your PRs are still in my review queue. Because of some unexpected work, and also me speaking at FOSDEM on 31 Jan, I'll have to look at this in early Feb, but other people with merge access are also welcome to help out. 😊 Thanks for waiting. |
Contributor
Author
|
Thanks for the update. No worries, the PRs are not blocking me since I'm working with my own fork, just thinking some of my fixes might help others too. Congrats on the talk and good luck with it ... and enjoy the nice beers in Bruxelles, I'm jealous :) |
Member
|
Thank you! 😊 |
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Feb 4, 2026
This adds or fixes support for the following matplotlib axis title (ax.set_title) features: - newlines: SVG `<text>` can't do that, need to use `<tspan>`s inside, see also [this SO q/a](https://stackoverflow.com/questions/16701522/how-to-linebreak-an-svg-text-within-javascript). - linespacing: naturally follows from wanting newlines. Needs exporter support, so PR mpld3/mplexporter#77 first. - left/right titles were completely missing; this adds support for those, which also needs exporter support, so this PR first: mpld3/mplexporter#78 - The `malign` property, which defines in the multi-line case, how the text lines should be aligned (all left, all center, all right). I made this with major help from gpt-codex-5.2, although in the end I went over all of its code and did a little simplifications here and there, needed multiple iterations overall.
lucasb-eyer
added a commit
to lucasb-eyer/mpld3
that referenced
this pull request
Feb 10, 2026
This adds or fixes support for the following matplotlib axis title (ax.set_title) features: - newlines: SVG `<text>` can't do that, need to use `<tspan>`s inside, see also [this SO q/a](https://stackoverflow.com/questions/16701522/how-to-linebreak-an-svg-text-within-javascript). - linespacing: naturally follows from wanting newlines. Needs exporter support, so PR mpld3/mplexporter#77 first. - left/right titles were completely missing; this adds support for those, which also needs exporter support, so this PR first: mpld3/mplexporter#78 - The `malign` property, which defines in the multi-line case, how the text lines should be aligned (all left, all center, all right). I made this with major help from gpt-codex-5.2, although in the end I went over all of its code and did a little simplifications here and there, needed multiple iterations overall.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In matplotlib, an axis has three titles: default one, but also left and right ones (that's what
loc=does). Export all three, if present.One design question here was whether to export left/right titles as "title" too for text_type, or as separate types.
I checked, all existing exporters simply ignore the text_type argument, so there are no compatibility considerations. Then, I think more info is strictly better, and if one were ever to care about titles in general, one could still do
if "title" in text_type.(Again, this is export only and should be an easy merge;
I'll send mpld3 rendering PR for this feature separately tomorrowHere it is: mpld3/mpld3#548. I've had gpt-codex-5.2 help me figure it out, but I wrote the code in the end.)