Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make histogram example figures fit on web page #8614

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
Jun 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make histogram example figures fit on web page
  • Loading branch information
dstansby committed May 12, 2017
commit 67d2324438357b62b81fb32c4596f062cbfaa3f5
4 changes: 2 additions & 2 deletions examples/statistics/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# edit the histogram to our liking. Let's change the color of each bar
# based on its y value.

fig, axs = plt.subplots(1, 2, figsize=(10, 5), tight_layout=True)
fig, axs = plt.subplots(1, 2, tight_layout=True)
Copy link
Member

Choose a reason for hiding this comment

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

This loses the "squareness" of the Axes, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does that matter? The first figure above isn't 'square'.

Copy link
Member

Choose a reason for hiding this comment

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

I assumed it was somewhat intentional in this one (since the first figure wasn't square.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see any particular reason - removing the figsize makes the two images match and fit on the webpage.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pinging @choldgraf who (IIRC) recently modified the example: was the “squareness” intentional?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was intentional just from an aesthetic standpoint, but I'm gonna chock this up to my OCD and say I'm +1 on changing it back since it looks dumb hanging off the side of the page like that :-)


# N is the count in each bin, bins is the lower-limit of the bin
N, bins, patches = axs[0].hist(x, bins=n_bins)
Expand Down Expand Up @@ -87,7 +87,7 @@
# Customizing a 2D histogram is similar to the 1D case, you can control
# visual components such as the bin size or color normalization.

fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharex=True, sharey=True,
fig, axs = plt.subplots(3, 1, figsize=(5, 15), sharex=True, sharey=True,
tight_layout=True)

# We can increase the number of bins on each axis
Expand Down