You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting the prop_cycle for an axis breaks the usage of keyword aliases in the plot function. In the following snippets the keyword lw=0.1 is ignored, but linewidth=0.1 produces the wanted result.
Maybe it is worth mentioning that color is still accessible via its alias c after setting a prop_cycle.
If it seems weird to set the prop_cycle to just ignore it: I stumbled across this problem while playing around with stylesheets to set a default cycle through different linestyles. But sometimes you want to explicitly change this behaviour.
At first, I was thinking this was a duplicate of #5875 (which is fixed in master), but I see that this is different. The problem here is that ax.plot() probably isn't properly normalizing all of the various keyword arguments, and as such doesn't detect that the cycler and the keyword property are colliding.
The plot() function explicitly normalizes the 'c' keyword into 'color', but it doesn't do it for any other properties. I think I can put together a patch for this utilizing the same normalization tool that the cycler goes through. @tacaswell, wasn't there another normalization mechanism that was added recently?
Ah. Yeah, I started looking into that, and I am not entirely sure it is ready for prime-time. At least, we don't really have the supporting data for it. One of the big problems I see is that it requires me to know what other keyword arguments will be allowed that don't go through the aliasing mechanism.
Perhaps it makes sense to break this function out into three levels. The first level simply does normalization (like I do in the validation step of prop_cycle), and the second level does precedence handling (conflict resolution), and the third level does the "required"/"allowed" handling?
I created #6345 that should address this problem. Note that v1.5.x will still have a problem if your manually created property cycle uses aliased property names, but that is fixed in 2.x as I noted earlier.
Activity
WeatherGod commentedon Apr 28, 2016
At first, I was thinking this was a duplicate of #5875 (which is fixed in master), but I see that this is different. The problem here is that ax.plot() probably isn't properly normalizing all of the various keyword arguments, and as such doesn't detect that the cycler and the keyword property are colliding.
The
plot()function explicitly normalizes the 'c' keyword into 'color', but it doesn't do it for any other properties. I think I can put together a patch for this utilizing the same normalization tool that the cycler goes through. @tacaswell, wasn't there another normalization mechanism that was added recently?tacaswell commentedon Apr 28, 2016
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/cbook.py#L2449 but we need to use it places now.
WeatherGod commentedon Apr 28, 2016
Sorry... my parser couldn't grok that sentence.
tacaswell commentedon Apr 28, 2016
I mean we have the function available to use, but we need to actually use it in
plot, etcWeatherGod commentedon Apr 28, 2016
Ah. Yeah, I started looking into that, and I am not entirely sure it is ready for prime-time. At least, we don't really have the supporting data for it. One of the big problems I see is that it requires me to know what other keyword arguments will be allowed that don't go through the aliasing mechanism.
Perhaps it makes sense to break this function out into three levels. The first level simply does normalization (like I do in the validation step of prop_cycle), and the second level does precedence handling (conflict resolution), and the third level does the "required"/"allowed" handling?
tacaswell commentedon Apr 28, 2016
the
allowedparameter only does something if it is notNone, otherwise it lets things pass through.WeatherGod commentedon Apr 28, 2016
I created #6345 that should address this problem. Note that v1.5.x will still have a problem if your manually created property cycle uses aliased property names, but that is fixed in 2.x as I noted earlier.
lkluft commentedon Apr 30, 2016
This seems to solve the problem properly so I closed the issue.
Thanks for the quick response!