8000 DOC: update anatomy of figure by jklymak · Pull Request #21753 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

DOC: update anatomy of figure #21753

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

Merged
merged 1 commit into from
Dec 10, 2021
Merged

Conversation

jklymak
Copy link
Member
@jklymak jklymak commented Nov 25, 2021

PR Summary

I have taken the liberty of tweaking the colors and fonts of this venerable graphic to something more in keeping with the current style.

Current:

sphx_glr_anatomy_001_2_0x

Suggested:

anatomy

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

ax.add_artist(circle)


def text(x, y, text):
ax.text(x, y, text, backgroundcolor="white",
ha='center', va='top', weight='bold', color='blue')
ax.text(x, y, text, backgroundcolor=(1, 1, 1, 1), zorder=100,
Copy link
Contributor
@anntzer anntzer Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps replace backgroundcolor by something like bbox={"fc": (1, 1, 1, .75)} (or even {'fc': 'w'}); the borderless, implicit white rectangles around text look a bit weird otherwise. Or use the same path_effect as circle does, to just add a bit of blank spacing around the glyphs only.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call - the stroke effect around the lettering works really well. See the updated plot above...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but I guess I'll let @rougier do the approval here.

@jklymak
Copy link
Member Author
jklymak commented Nov 26, 2021

BTW ping @rougier as I think you made the original. If you want to have a go at updating this, I'm sure no one would object!

@tacaswell tacaswell added this to the v3.5-doc milestone Nov 26, 2021
@jklymak
Copy link
Member Author
jklymak commented Nov 28, 2021

Here is another version from the latest commit that adds some code. A bit messy for review, but for discussion if better or worse than the simpler version:

anatomy2

@anntzer
Copy link
Contributor
anntzer commented Nov 28, 2021

I like it a lot. However, if you're going to mention ax.scatter, I think you should actually have some variation either in size or in color (if you're just using the same marker everywhere I'd rather encourage people to use plot for that).

@jklymak jklymak force-pushed the doc-update-anatomy branch 2 times, most recently from c434340 to 7817b35 Compare November 28, 2021 18:38
@jklymak
Copy link
Member Author
jklymak commented Nov 28, 2021

I agree that ax.plot would be better, and indeed that is what is used in the code. OTOH,for maximum info content, it seems better to reference scatter, and I'm somewhat reluctant to make the plot more complicated.

@StefRe
Copy link
Contributor
StefRe commented Nov 29, 2021

Well strictly speakting, this mostly shows the anatomy of an Axes, not a Figure. Maybe we can have a plot "Anatomy of a Figure" showing two Axes (subplots) and a Figure title (maybe also wspace) and another one "Anatomy of an Axes" like the one above but with just one curve with markers?

Also maybe it's worth to denote the Axis with a big rounded rectangle including the ticks and tick labels instead of the circle, otherwise it's a bit unclear how an Axis differs from a spine.

Anatomy_of_a_Figure Anatomy_of_an_Axes

Just a concept, needs to be fine tuned and the additional figure text and the axes legends etc. maybe too confusing and the color is certainly not optimal (the left Axes color = the right Figure color to show correspondence). The main idea was to show what belongs to a Figure and what to an Axes.

(code see this gist)

@jklymak
Copy link
Member Author
jklymak commented Dec 7, 2021

I thought of using colors, but then the little circle illusion becomes confusing rather than helpful. Certainly one could come up with other versions of this, but it is a venerable figure, so I was loathe to change it too substantially.

I would vote to stay with "Anatomy of a Figure". Everyone knows what a "Figure" is, whereas "Axes" is more jargonny, and indeed part of what this figure is meant to demonstrate.

@timhoffm
Copy link
Member
timhoffm commented Dec 7, 2021

I'd also say, let's stick to this style-updated version of the current figure for now. We can always make further changes later.

@jklymak jklymak added the Documentation: website layout/behavior/styling changes label Dec 9, 2021
@timhoffm timhoffm merged commit 9bf4eb2 into matplotlib:main Dec 10, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 10, 2021
@timhoffm
Copy link
Member

Merged. There has been enough time to speak up against this.

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 10, 2021
QuLogic added a commit that referenced this pull request Dec 10, 2021
…753-on-v3.5.x

Backport PR #21753 on branch v3.5.x (DOC: update anatomy of figure)
QuLogic added a commit that referenced this pull request Dec 10, 2021
…753-on-v3.5.0-doc

Backport PR #21753 on branch v3.5.0-doc (DOC: update anatomy of figure)
@rougier
Copy link
Member
rougier commented Dec 15, 2021

AArrg, too late but:

  • why change the discs for squares?
  • why italics?
  • why making the circle linewidth so strong?
  • some of the cicles are not centered on what they are suposed to show
  • why the mono serif font ?
  • circles should stay black

@jklymak
Copy link
Member Author
jklymak commented Dec 15, 2021

Its not particularly too late, this is only in the devdocs so far... Ooops, sorry take that back, I guess it is in the current examples. But I think that is obscure enough that it is easy to change.

@jklymak jklymak deleted the doc-update-anatomy branch December 15, 2021 12:22
@jklymak
Copy link
Member Author
jklymak commented Dec 15, 2021

AArrg, too late but:

  • why change the discs for squares?
  • why italics?
  • why making the circle linewidth so strong?

These were just aesthetic choices. But I'm not trying to claim I have any taste, just the very old version was outdated.

  • some of the cicles are not centered on what they are suposed to show

Yes, I can see a few of them are a bit off

  • why the mono serif font ?

To indicate that it is code?

  • circles should stay black

Aesthetic choice again - I thought it useful differentiate the plot elements and the annotations.

@rougier
Copy link
Member
rougier commented Dec 15, 2021

I would prefer to minimize changes for a first update and the we can discuss further changes. Obviously my aesthetic choices are a bit different than yours (and it's fine) but I would prefer we dicuss them a bit more before making changes.
Different font for code is a good idea indeed, my question was related to the serif choice. As for circles, I would either keep them black or chose a color different from the line plot (else, it suggests an identical semantical meaning, sort of).

@jklymak
Copy link
Member Author
jklymak commented Dec 15, 2021

Sure, well lets just revert, and consider this an open issue that the old version could use some freshening.

@rougier
Copy link
Member
rougier commented Dec 15, 2021

I agree that figure need some update. Let's start with the updated version and check if we can change this or that aspecT.

@jklymak
Copy link
Member Author
jklymak commented Dec 15, 2021

This is definitely your figure, so happy to approach it how you would like!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: website layout/behavior/styling changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0