-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Further cleanup rainbow_text example. #26057
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
Conversation
I don't like the visual appearance now:
General notes:
|
Good points all around. I streamlined the whole thing; how does that look to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in code suggestions:
- Parameter name
c
->color
for readability - increase font size to make the text more prominent (in particular also in the thumbnail
Can we rename the example? "Rainbow text" is not quite instructive. Either to the purpose "Complex test formatting" (with the nuissance that this is a hackish solution when selling it as text formatting) or to the technical solution "Concatenating text object". Other titles welcome.
fig, ax = plt.subplots() | ||
|
||
# The first word, created with text(). | ||
text = ax.text(.1, .5, "Matplotlib", c="red") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text = ax.text(.1, .5, "Matplotlib", c="red") | |
text = ax.text(.1, .5, "Matplotlib", color="red", fontsize=20) |
" says,", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
c="gold", weight="bold", # custom properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" says,", xycoords=text, xy=(1, 0), verticalalignment="bottom", | |
c="gold", weight="bold", # custom properties | |
" says,", xycoords=text, xy=(1, 0), verticalalignment="bottom", fontsize=20, | |
color="gold", weight="bold", # custom properties |
" hello", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
c="green", style="italic", # custom properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" hello", xycoords=text, xy=(1, 0), verticalalignment="bottom", | |
c="green", style="italic", # custom properties | |
" hello", xycoords=text, xy=(1, 0), verticalalignment="bottom", fontsize=20, | |
color="green", style="italic", # custom properties |
" world!", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
c="blue", family="serif", # custom properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" world!", xycoords=text, xy=(1, 0), verticalalignment="bottom", | |
c="blue", family="serif", # custom properties | |
" world!", xycoords=text, xy=(1, 0), verticalalignment="bottom", fontsize=20, | |
color="blue", family="serif", # custom properties |
(e.g., color or font), positioning each one after the other: each Text other | ||
than the first one created with `~.Axes.annotate` and positioned so that its | ||
lower left corner is at the lower right corner (``xy=(1, 0)``) of the previous | ||
one (``xycoords=text``). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(e.g., color or font), positioning each one after the other: each Text other | |
than the first one created with `~.Axes.annotate` and positioned so that its | |
lower left corner is at the lower right corner (``xy=(1, 0)``) of the previous | |
one (``xycoords=text``). | |
(e.g., color or font), positioning each one after the other: The first Text is | |
directly created using `~.Axes.text`. All subsequent Texts are created with | |
`~.Axes.annotate`, which allows positioning so that its lower left corner is at | |
the lower right corner (``xy=(1, 0)``) of the previous one (``xycoords=text``). |
Sure, done. |
Share more code between horizontal and vertical cases.
Show that x, y can use any transform (as for any text() call).
Standardize docs of "extra" properties.
Small doc rewordings.
followup to #25993.
PR summary
PR checklist