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
{{ message }}
Repository navigation
flier objects missing from structure return by boxplot #3544
import matplotlib.pyplot as plt
def makeItGreen(boxpl):
for key in boxpl:
for obj in boxpl[key]:
plt.setp(obj, color="green")
plt.clf()
x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56]
bp = plt.boxplot(x, sym="o")
makeItGreen(bp)
plt.show()
should create a boxplot with an outliner and then color everything green. This works as expected with matplotlib 1.3.1. With 1.4.0, the outlier does not change its color but remains blue. In 1.3.1, boxplot() returned a structure whose "fliers" field contained two objects; now there is just one.
MPL 1.3 returned objects for two flier objects: the upper and lower fliers. I merged those objects together. We can split them back up, but that's not the cause of their properties not being set.
Then a corresponding matploltib 1.4 notebook. In both cases, bp['fliers'] are Line2D objects. However, in matplotlob 1.4, you have to set_markerfacecolor, not simply set_color.
So I see a couple of possible issues:
there is something different about the new boxplot's doplot inner function that is calling/returning slightly different objects; or
something about Line2D objects changed -- namely, set_color now only applies to the color of a the line in v1.4 and not the line and the markers like it did in version 1.3.
I am inclined to not split them back up (unless a boxplot expert tells me that setting the upper and lower fliers to be different colors is a thing.
@TomAugspurger Looks like we had an undocumented API change and the number of artist should be reduced.
The issues with the colors is that Line2D objects have some internal logic that allows the markerfacecolor and markeredgecolor to take precedence over color (the mechanism is that the marker* colors default to 'auto' which gets intercepted and replaced by the value for color in the function _get_marker_facecolor). I think the way to fix this to in the parsing of sym (now in boxplot) to delete setting the markerface and edge colors and do the same with the default flier dict.
If this happens in the future I'll try to point them out more quickly. I'm usually somewhat up to date with mpl master and the pandas test suite give you all some extra coverage. This time I noticed the failure and just kept putting off investigating it :)
No, I'm sorry @TomAugspurger and @tacaswell. When I was creating the bxp function and refactoring boxplot to use it, I thought, "oh two if statements and plotting calls that very easily could be one" and didn't consider the downstream implications of that. Lots of lessons learned here, for me.
Activity
tacaswell commentedon Sep 30, 2014
@phobson any progress on this?
phobson commentedon Sep 30, 2014
@tacaswell Diagnostically, yes.
MPL 1.3 returned objects for two flier objects: the upper and lower fliers. I merged those objects together. We can split them back up, but that's not the cause of their properties not being set.
See this matploltib 1.3 notebook where everything works as expected.
Then a corresponding matploltib 1.4 notebook. In both cases,
bp['fliers']are Line2D objects. However, in matplotlob 1.4, you have toset_markerfacecolor, not simplyset_color.So I see a couple of possible issues:
doplotinner function that is calling/returning slightly different objects; orset_colornow only applies to the color of a the line in v1.4 and not the line and the markers like it did in version 1.3.tacaswell commentedon Sep 30, 2014
I am inclined to not split them back up (unless a boxplot expert tells me that setting the upper and lower fliers to be different colors is a thing.
@TomAugspurger Looks like we had an undocumented API change and the number of artist should be reduced.
The issues with the colors is that
Line2Dobjects have some internal logic that allows themarkerfacecolorandmarkeredgecolorto take precedence overcolor(the mechanism is that themarker*colors default to'auto'which gets intercepted and replaced by the value forcolorin the function_get_marker_facecolor). I think the way to fix this to in the parsing ofsym(now in boxplot) to delete setting the markerface and edge colors and do the same with the default flier dict.TomAugspurger commentedon Sep 30, 2014
👍 Thanks. I'll adjust our test.
If this happens in the future I'll try to point them out more quickly. I'm usually somewhat up to date with mpl master and the pandas test suite give you all some extra coverage. This time I noticed the failure and just kept putting off investigating it :)
phobson commentedon Sep 30, 2014
No, I'm sorry @TomAugspurger and @tacaswell. When I was creating the
bxpfunction and refactoringboxplotto use it, I thought, "oh twoifstatements and plotting calls that very easily could be one" and didn't consider the downstream implications of that. Lots of lessons learned here, for me.phobson commentedon Sep 30, 2014
@tacaswell do you mean e.g., here and here
tacaswell commentedon Sep 30, 2014
Yes, and https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L3323
tacaswell commentedon Oct 1, 2014
closed by #3600