Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding font Size as default parameter#29258

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
oscargus merged 34 commits intomatplotlib:mainfromsaikarna913:main
Dec 16, 2024
Merged

Conversation

saikarna913
Copy link
Contributor

Adding the font size as default parameter
This PR Solves#29202

PR summary

-This PR automatically adjusts the font size when creating the table, provided the fontsize argument is specified, without requiring an explicit call to the set_fontsize function.
-Automatically applying the font size ensures consistent styling during table creation, streamlining the process for users. It eliminates the need for additional method calls

PR checklist

import matplotlib.pyplot as pltimport numpy as np# Data for plottingx = np.linspace(0, 10, 100)y = x + 1tableData = [['a', 1], ['b', 1]]# Create the figure and axis objectsfig, ax = plt.subplots()# Plot the dataax.plot(x, y)# Add a tablet = ax.table(    cellText=tableData,  # Table content    loc='top',  # Position of the table    cellLoc='center',  # Center-align the text in cells    fontsize=30  # Set the font size for the table)# Save the figure as an imageplt.savefig('output_plot_with_table_after.png')  # Save as PNG file# Optionally, close the plot (no need to display it)plt.close()

I got this output
image

@saikarna913
Copy link
ContributorAuthor

saikarna913 commentedDec 8, 2024
edited
Loading

@tacaswell please help me why mypy is failing I haven't changed the pylab.py code. please approve and merge this pr is there is no issue

@timhoffm
Copy link
Member

The mypy issue is unrelated and happens also on other PRs. It can be ignored here.

@saikarna913
Copy link
ContributorAuthor

saikarna913 commentedDec 9, 2024
edited
Loading

@rcomer can you review my PR and approve it, As per@timhoffm suggestion, I guess mypy issue can be ignored.

@saikarna913
Copy link
ContributorAuthor

@timhoffm i guess now this PR can be merged. it would be a great encouragement for me as a beginner in open source. if there is any issue please let me know

@QuLogicQuLogic mentioned this pull requestDec 10, 2024
3 tasks
@saikarna913
Copy link
ContributorAuthor

@timhoffm I don't understand why these are passing sometimes and failing. in the last commit pre-commit. ci failed due to the whitespace, so I removed the whitespace and then [Tests / Python 3.13 on macos-14 (pull_request)] is failing

@rcomer
Copy link
Member

Unfortunately the MacOS tests can be flakey and sometimes show failures that are not caused by the PR. You just got unlucky when you removed the white space.

@oscargusoscargus added this to thev3.11.0 milestoneDec 16, 2024
@rcomer
Copy link
Member

I wasn’t sure if a docstring change would be needed sincefontsize is already listed as aTable property under kwargs.

@timhoffm
Copy link
Member

I wasn’t sure if a docstring change would be needed sincefontsize is already listed as aTable property under kwargs.

The important thing is that every parameter is documented, direct or indirectly. There is no 1:1 relation that an explicit parameter must be documented explicitly, or vice versa. Typically, if we use explicit parameters for Artist properties, it's because they have a special meaning / modified functionality, which warrant explicit documentation. But here we just need the value to make the table behave as expected. We don't need to communicate additional information and thus don't need an explicit docstring.

rcomer reacted with thumbs up emojircomer reacted with eyes emoji

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Take one of my two comments: Either make the newfontsize parameter keyword-only or don't introduce an explicitfontsize parameter and instead take the value from kwargs.

saikarna913and others added4 commitsDecember 16, 2024 15:42
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@oscargusoscargus merged commit45e0cf3 intomatplotlib:mainDec 16, 2024
33 of 36 checks passed
@oscargus
Copy link
Member

Thanks! One may consider if this is a bugfix and therefore should be backported.

@timhoffm
Copy link
Member

@meeseeksdev backport to v3.10.1

@lumberbot-appLumberbot (App)
Copy link

Something went wrong ... Please have a look at my logs.

It seems that the branch you are trying to backport to does not exist.

@timhoffm
Copy link
Member

@meeseeksdev backport to v3.10.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestDec 16, 2024
@rcomerrcomer modified the milestones:v3.11.0,v3.10.1Dec 16, 2024
timhoffm added a commit that referenced this pull requestDec 16, 2024
…258-on-v3.10.xBackport PR#29258 on branch v3.10.x (Adding font Size as default parameter)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm left review comments

@oscargusoscargusoscargus approved these changes

@rcomerrcomerrcomer approved these changes

Assignees
No one assigned
Labels
PR: bugfixPull requests that fix identified bugstopic: table
Projects
None yet
Milestone
v3.10.1
Development

Successfully merging this pull request may close these issues.

[Bug]:fontsize in tables not working
4 participants
@saikarna913@timhoffm@rcomer@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp