Skip to content

Cleanup scalarformatter.py example. #25968

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
May 25, 2023
Merged

Cleanup scalarformatter.py example. #25968

merged 1 commit into from
May 25, 2023

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 24, 2023

Move everything to a single figure for better comparability and remove repeated code.

old: https://matplotlib.org/stable/gallery/ticks/scalarformatter.html
new:
test

PR summary

PR checklist

@timhoffm
Copy link
Member

timhoffm commented May 24, 2023

Optional suggestion: Make the column titles more prominent by using a larger font size or bold font. Right now the titles look very similar to the tick labels and are thus a bit hard to see at first glance.

Copy link
Contributor

@StefRe StefRe left a comment

Choose a reason for hiding this comment

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

I personally would swap columns 2 and 3 because col 3 is the same offset as col 1 just with different formatting and drop the last row as it adds nothing compared to the second row:

out

ax4.ticklabel_format(useMathText=True)

fig.subplots_adjust(wspace=0.7, hspace=0.6)
fig, axs = plt.subplots(4, 3, figsize=(9, 12), layout="constrained")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe move the rows a bit apart so that it's visually clearer that y-axis offsets pertain to the below and x-axis offsets to the above plot:

fig, axs = plt.subplots(4, 3, figsize=(9, 12), layout="constrained", gridspec_kw=dict(hspace=0.1))

axs[0, 0].set_title("default settings")
axs[0, 1].set_title("no numerical offset")
axs[0, 2].set_title("with mathtext")
fig.align_ylabels()
Copy link
Contributor

Choose a reason for hiding this comment

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

this line can be removed - there are no y labels here


axs[0, 0].set_title("default settings")
axs[0, 1].set_title("no numerical offset")
axs[0, 2].set_title("with mathtext")
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe vertically align titles (the last one is a bit higher due to the exponents in the offset):

axs[0, 0].set_title("default settings", y=1.1)
axs[0, 1].set_title("no numerical offset", y=1.1)
axs[0, 2].set_title("with mathtext", y=1.1)

@story645
Copy link
Member

story645 commented May 24, 2023

Yeah similar to Tim's request, I'm having a hard time seeing the differences - maybe it's just the crowding on the figure - is there a way to put more space between subplot?

Eta: what is the reason for showing each row?

Eta2: agree with @StefRe, just didn't see it before I posted

@anntzer
Copy link
Contributor Author

anntzer commented May 24, 2023

Thanks for the review, all comments handled.

Move everything to a single figure for better comparability and remove
repeated code.
@anntzer
Copy link
Contributor Author

anntzer commented May 25, 2023

thanks, slightly reworded and included the changes.

@timhoffm timhoffm merged commit 5438e94 into matplotlib:main May 25, 2023
@anntzer anntzer deleted the dtf branch May 25, 2023 17:23
@QuLogic QuLogic added this to the v3.8.0 milestone May 25, 2023
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.

5 participants