-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH]: Switch text wrapping boundary to subfigure #28378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm confused why this doesn't already work, since In [11]: fig = plt.figure()
In [12]: sfig = fig.subfigures()
In [13]: ax = sfig.subplots()
In [14]: txt = ax.text(0, 0, "foo")
In [15]: txt
Out[15]: Text(0, 0, 'foo')
In [16]: txt.get_figure()
Out[16]: <matplotlib.figure.SubFigure at 0x7f2eff1b6ed0> |
Should matplotlib/lib/matplotlib/text.py Line 665 in 14a04a0
Edit: and some of the lines above it. I guess when this was written |
I have just checked that the code in #28358 (comment) does not wrap - assuming it was due to the root figure, but it may well be that there is a calculation issue instead. |
Titles do not have a wrapping problem... 😕 fig = plt.figure()
sfig1, sfig2 = fig.subfigures(ncols=2)
ax1, ax2 = sfig2.subplots(nrows=2)
ax2.set_title("Another title that won't fit in this amount of space", wrap=True)
sfig2.suptitle("Long title that won't fit in this amount of space", wrap=True)
plt.show() |
I can confirm both that tick labels wrap incorrectly and titles wrap correctly and that the tick labels have the correct (sub) figure attached to them. Very odd. |
`_get_dist_to_box()` assumed that the figure box (x0, y0) coordinates are 0, which was correct at the time of writing, but does not hold anymore since the introduction of subfigures. Closes matplotlib#28378 Closes matplotlib#28358
`_get_dist_to_box()` assumed that the figure box (x0, y0) coordinates are 0, which was correct at the time of writing, but does not hold anymore since the introduction of subfigures. Closes matplotlib#28378 Closes matplotlib#28358
Problem
xref #28358 (comment)
Proposed solution
When #28177 is in, we could switch the wrapping box to subfigure.
Actions:
get_figure()
call inText._get_wrap_line_width
Text.set_wrap
documentation to explicitly mention subfigure.The text was updated successfully, but these errors were encountered: