Repository navigation
Further cleanup rainbow_text example. - #26057
Merged
Merged
Conversation
Member
|
I don't like the visual appearance now:
General notes:
|
Contributor
Author
|
Good points all around. I streamlined the whole thing; how does that look to you? |
timhoffm
reviewed
Jun 4, 2023
Member
There was a problem hiding this comment.
in code suggestions:
- Parameter name
c->colorfor 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") |
Member
There was a problem hiding this comment.
Suggested change
| text = ax.text(.1, .5, "Matplotlib", c="red") | |
| text = ax.text(.1, .5, "Matplotlib", color="red", fontsize=20) |
Comment on lines
+22
to
+23
| " says,", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
| c="gold", weight="bold", # custom properties |
Member
There was a problem hiding this comment.
Suggested change
| " 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 |
Comment on lines
+26
to
+27
| " hello", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
| c="green", style="italic", # custom properties |
Member
There was a problem hiding this comment.
Suggested change
| " 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 |
Comment on lines
+30
to
+31
| " world!", xycoords=text, xy=(1, 0), verticalalignment="bottom", | ||
| c="blue", family="serif", # custom properties |
Member
There was a problem hiding this comment.
Suggested change
| " 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 |
Comment on lines
+7
to
+10
| (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``). |
Member
There was a problem hiding this comment.
Suggested change
| (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``). |
Contributor
Author
|
Sure, done. |
timhoffm
approved these changes
Jun 4, 2023
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.

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