Skip to content
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

Avoid editing of matplotlib rcParams in source code #3

Open
vinisalazar opened this issue May 8, 2024 · 1 comment
Open

Avoid editing of matplotlib rcParams in source code #3

vinisalazar opened this issue May 8, 2024 · 1 comment

Comments

@vinisalazar
Copy link

Hi,

Thank you for providing this package. I was trying to plot a biplot with your other package, pca, and was having the hardest time figuring out why my matplotlib rcParams were not coming into effect. Not only was the biplot not coming out the way I wanted, when I added it to my figure, it would also modify the other subplots in the figure.

Turns out it was due to this line: https://github.com/erdogant/scatterd/blob/cdeacf33fdcff3459a7d14959edab2d825fd4026/scatterd/scatterd.py#L269C1-L270C1

I would like to suggest either removing this statement and finding an alternative way to set the font properties, or at least adding a warning to other users that may run into similar problems (not sure if verbose mode would account for that?)

I'd be happy to submit a PR with proposed changes, if you would welcome that.

Thank you!
Vini

@erdogant
Copy link
Owner

erdogant commented May 8, 2024

Thanks for the suggestion. If there is another manner to do this, and keeping the results the same, that would be an option. I'am interested to see/test your solution.

vinisalazar added a commit to vinisalazar/scatterd that referenced this issue May 9, 2024
  - In function _set_font_properties, use matplotlib.rc_context()

  This resets the rcParams upon leaving the context body, which prevents the parameters set here
  from interfering with the rest of the figure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants