Skip to content

Add example for specifying figure size in different units - #18360

Merged
jklymak merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-figsize
Aug 26, 2020
Merged

jklymak merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-figsize

Conversation

@timhoffm

Copy link
Copy Markdown
Member

PR Summary

This explains and illustrates best practices for working with figure sizes in units differing from the default inches.

This addresses the user needs of #12402 as good as possible without introducing new API.

@jklymak jklymak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks helpful. A few suggestions?


matplotlib.pyplot.figure
matplotlib.pyplot.subplots
matplotlib.pyplot.subplot_mosaic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not used?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is to trigger the back links which I think is useful here (as these are the entry points where we want people to use to set the figure size)?

# conversion almost look like appending a unit to the number, which is nicely
# readable.
#
cm = 1/2.54 # cm in inches

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was 90% sure this was exact, but had to look it up to be 100% sure. You may want to indicate that with a link to https://en.wikipedia.org/wiki/Inch? and/or more decimal places? Or at least say its exact?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

IMHO that'd be overly cautious. One should assume that code/logic is correct unless explicitly indicated as an approximation. I'd really feel awkward adding something like "Look, what we're doing is really correct. Here is the proof".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, but doing 1/2.5400 wouldn't hurt?

@jklymak jklymak added this to the v3.4.0 milestone Aug 26, 2020
@jklymak
jklymak merged commit c035f66 into matplotlib:master Aug 26, 2020
@timhoffm
timhoffm deleted the doc-figsize branch August 27, 2020 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants