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

'matplotlib' option no longer working in utils.plotting.set_style() #513

Closed
evepug opened this issue Feb 6, 2024 · 8 comments · Fixed by #518
Closed

'matplotlib' option no longer working in utils.plotting.set_style() #513

evepug opened this issue Feb 6, 2024 · 8 comments · Fixed by #518

Comments

@evepug
Copy link

evepug commented Feb 6, 2024

Bug description: I prefer to avoid changes to default matplotlib formats that occur when importing pyleoclim by using the 'matplotlib' option in pyleo.utils.plotting.set_style(), but since updating to a newer version of the package in the past week, this option no longer seems available (although it is still listed in the documentation).

To reproduce:
from pyleoclim import utils
utils.plotting.set_style(style='matplotlib')

Which returns the error message:
ValueError: Style [matplotlib] not availabel!

Choosing other style options like 'journal' or 'web' runs without errors and seems to work as expected.

Looking at the source code for the utils.plotting.set_style function, it appears that the 'matplotlib' style option is not defined anywhere, whereas the other options (journal, web, spines, etc.) are defined. Restoring this option so it's possible to import pyleoclim and keep current matplotlib settings without having to reset rcparams would be helpful.

Edit to add: I'm using version 0.13.0

@khider
Copy link
Member

khider commented Feb 8, 2024

Do you remember when you last used this option? Trying to roll back but it would help to have a date

@khider
Copy link
Member

khider commented Feb 8, 2024

@fzhu2e Seems that it was removed in commit 8fffc09. Any ideas why?

@evepug
Copy link
Author

evepug commented Feb 9, 2024

@khider Looks like you already found where it was removed, but in case it's still useful I was previously using a version of the package I think I downloaded in early 2021.

@fzhu2e
Copy link
Collaborator

fzhu2e commented Feb 9, 2024

@fzhu2e Seems that it was removed in commit 8fffc09. Any ideas why?

Sorry, it has been too long and I can't remember exactly why I removed that. It's probably that it's not working as expected in certain cases at that time, and I did that to avoid confusion. Please feel free to put it back and have a test to see if it works. Things could be different now.

@khider
Copy link
Member

khider commented Feb 14, 2024

Ok, I reinstated matplotlib on my version of the code. Two concerns:

  1. By default, Matplotlib doesn't show plots anymore. So one needs to do the following:
import pyleoclim as pyleo
import matplotlib.pyplot as plt
pyleo.set_style('matplotlib')

ts = pyleo.utils.load_dataset('LR04')
fig,ax=ts.plot()
plt.show(fig)

Second concern: The stack plot doesn't work with this style:

image

I could put a warning when the style is selected that some functionalities may no longer work and push the change. Any suggestions @CommonClimate and @fzhu2e ?

@evepug
Copy link
Author

evepug commented Feb 14, 2024 via email

@evepug
Copy link
Author

evepug commented Feb 15, 2024

thank you!

@evepug evepug closed this as completed Feb 15, 2024
@fzhu2e
Copy link
Collaborator

fzhu2e commented Feb 15, 2024

Ok, I reinstated matplotlib on my version of the code. Two concerns:

1. By default, Matplotlib doesn't show plots anymore. So one needs to do the following:
import pyleoclim as pyleo
import matplotlib.pyplot as plt
pyleo.set_style('matplotlib')

ts = pyleo.utils.load_dataset('LR04')
fig,ax=ts.plot()
plt.show(fig)

Second concern: The stack plot doesn't work with this style:

image

I could put a warning when the style is selected that some functionalities may no longer work and push the change. Any suggestions @CommonClimate and @fzhu2e ?

Yes, I agree a warning is needed. stackplot is a unique application and the style is hard-coded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants