Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Adding Scalar as a Baseline Option#27308
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
base:main
Are you sure you want to change the base?
Adding Scalar as a Baseline Option#27308
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I think that restricting to an I also think that perhaps even more important than the code change allowing |
pedrompecanha commentedNov 19, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm pair programming alongside@EricRLeao1311. We've changed to code so it accepts floats, but we still have some questions about testing and documentation. About testing, how could we improve/fix it? We found some tests in test_axes.py, but they use a @image_comparison wrapper, and we are unsure on how to make it work for our case. We tried to include some cases, but we don't know if they were made correctly. And about documentation, we attempted to improve the docstrings related to the function. Is that enough? Thanks! |
lib/matplotlib/tests/test_axes.py Outdated
try: | ||
axs[0, 0].stackplot(range(100), d.T, baseline=5) | ||
except ValueError as e: | ||
print("Error when using an integer as baseline:", e) |
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.
If you are testing something that should fail the test if the error is raised, then remove the try/except.
If you are testing that thisshould raise, then usewith pytest.raises(...)
which will ensure that the exception is actually raised (where printing will just ignore whether or not an exception was raised)
I still think float is too restrictive, and that we should be looking at unit-aware changes, so while |
Ok, I see that you want it to be more expansive than float-only, but we are having trouble on what types we should accept and how to treat the different types. Could you enlighten us in any type of way? |
Because the units system can have arbitrary values, there isno restriction on the type, much like the https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar.html This should be treated similarly, in that it gets passed through matplotlib/lib/matplotlib/axes/_axes.py Line 2426 ineb02b10
Where this has odd behavior:
I think that it could be:
|
PR summary
Allowing an int to be received as a baseline option in stackplots, to prevent cases where the baseline is not sensible enough.
Closes#27129
PR checklist