-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix plot-series #533
Fix plot-series #533
Conversation
@gracewgao this looks like a nice fix! Would you like to add a unit test too? If yes, we could merge this PR first or you could add it to this one, whatever you prefer. If you have time, could you also check if it works as expected with integer indices? For example, here the index is wrong: from sktime.forecasting.all import *
from sktime.utils._testing.forecasting import _make_series
y = _make_series(index_type="int")
print(y.index)
>>> Int64Index([ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52],
dtype='int64')
plot_series(y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright - yes so this PR looks great! I'll leave it open for a bit longer in case someone else wants to comment but it's ready to be merged from my side!
For the unit test, the main thing to check is the x-axis I think for different input combinations.
Thanks again @gracewgao - now merged! |
This issue seems to still persist in version 0.5.2. Can I ask how I would import the changes? I am plotting the output of |
@mloning a screenshot is attached.
|
Reference Issues/PRs
Fixes #519
What does this implement/fix? Explain your changes.
As the issue points out, the x-axis labels don't match with the data points plotted. It turns out that mathplotlib recommends a different solution for dynamically assigning tick labels from a list. I tweaked this code a bit to accommodate multiple series, which gives this result:
Does your contribution introduce a new dependency? If yes, which one?
No, I just imported some new functions from mathplotlib.ticker and mathplotlib.cbook.
PR checklist
For all contributions
For new estimators
Any other comments?
I'm not too sure what parts of the PR checklist are relevant - feel free to let me know if there are any changes / additional actions that I should take!