Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Fix log transforms (fixes #3809) [back port to 1.4.x]#3863
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
pelson commentedNov 29, 2014
Could do with a test. 😉 |
pelson commentedNov 29, 2014
Does this also fix the documentation? |
a340546 tob5685f4Comparemaxalbert commentedNov 29, 2014
Yes, it should also fix the documentation. In terms of test, are you essentially thinking of running the code snippet in the description of#3809 to ensure that it doesn't raise an exception? |
WeatherGod commentedNov 29, 2014
There is also a "bug report" of sorts in the mailing list from about a On Sat, Nov 29, 2014 at 12:35 PM, maxalbertnotifications@github.com
|
WeatherGod commentedNov 29, 2014
Found it... could this possibly fix#3540? On Sat, Nov 29, 2014 at 12:37 PM, Benjamin Rootben.root@ou.edu wrote:
|
tacaswell commentedNov 29, 2014
@maxalbert Yes, @cleanupdeftest_log_transform():fig,ax=plt.figure()ax.set_yscale('log')# <--- works fine without this lineax.transData.transform((1,1))# <--- exception thrown here Would be good enough. The |
…o ensure we have a 2D array to avoid further case distinctions below.
…o a 2d array before applying any transforms and then convert the result back to the original shape.
maxalbert commentedDec 4, 2014
@tacaswell Thanks! I have updated this PR with the suggested test. I had hoped that with the fix in#3866 it would just work, but it turns out that there were still problems because some (most?) of the transformation code on the Python side assumes that the input values are 2d. I can see two solutions to this: (1) Do not support transforming a single point but always require the input to be a list of points. This would at least ensure consistency, but it would be somewhat unintuitive for the user and also require changes in the documentation. (2) Support transforming a single point. This feels nicer from a user's point of view so I have chosen it for the current PR. My current solution in order to avoid messing with too much of the existing code is to unconditionally convert the input to a 2d array in |
pelson commentedDec 4, 2014
I think this is looking good. Thanks@maxalbert.@mdboom - would you mind commenting? |
maxalbert commentedDec 4, 2014
@WeatherGod I just double-checked but unfortunately this does not fix#3540. |
mdboom commentedDec 4, 2014
Thanks for this. I'm concerned about the performance impact of this pretty central piece of code -- but I have no suggestion to improve it. As I mentioned in#3866 I'm not crazy about the way |
maxalbert commentedDec 5, 2014
I was wondering about the performance impact as well so I just did some quick-and-dirty profiling in IPython. I'm simply using importmatplotlib.pyplotaspltfig,ax=plt.subplots() as the setup and am timing various transforms by applying so it looks reasonably complicated. Do you think it's representative for a typical transform? Anyway, here are the results: Current master: On branch fix_log_transforms: These numbers are pretty reproducible. It looks like transforming a single point is actually faster now. There is a slight overhead for 2d arrays but it doesn't appear to be huge, so hopefully we won't see too much of a performance impact for now. I take your point about treating the single-point case differently, though. I guess ultimately it's a tradeoff of user convenience vs. code tidiness (and perhaps performance). You core developers certainly have a much better feeling for what's best in this situation and I'm happy to go with that. If there is a consensus that single-point transforms shouldn't be supported despite this being a (slight) inconvenience for users then I'm happy to scrap this PR and open a new one. |
mdboom commentedDec 5, 2014
Thanks for the timings. I should have mentioned that my concerns were purely theoretical -- it's nice to have solid numbers. I think the thing to do is to merge this now (now that my timing concerns are mostly assuaged), and consider changing the API later in a more considered way. In a sense, this is just a bugfix at this point. |
WeatherGod commentedDec 5, 2014
Just my two cents, I think it makes sense to accept single points as On Fri, Dec 5, 2014 at 9:39 AM, Michael Droettboom <notifications@github.com
|
Fix log transforms (fixes#3809).Conflicts:lib/matplotlib/tests/test_transforms.pycherry-pick diff picked up too many tests in test_transforms.py
tacaswell commentedJan 13, 2015
backported as9d97a21 |
No description provided.