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
The x-axis limits used to be 0 to 4. They are now roughly 0.5 to 2.5.
The tick marks used to be at [0, 0.5, 1, 2, 3.5, 4]. They are now at [1, 2].
The tick mark labels used to be ['a','b','c', '2', '3.5', '4']. They are now ['a', 'b']. Based on the changes in (1) and (2) I would have expected the tick mark labels to be ['c', '2'].
The obvious work around is to set these parameters after you have called axes.boxplot(). However, reseting the axes is not consistent with axes.plot(), axes.bar(), axes.imshow(), or any other plotting method I have used. Other methods respect the user specified x limits and tick marks. This behavior also is not consistent with the y-axis behavior in boxplot. Boxplot respected the user specified y limits and tick marks.
You are misunderstanding how ticks/tick labels behave. When you use set_xticks and set_xticklabels you are really creating 'FixedLocatorandFixedFormatter` objects. The former says 'put ticks at these places', the second says 'use this list of strings to generate the tick labels'. What is going on is that box-plot is changing the xticks so that the ticks fall under the boxes (which is 99% of the time the correct behaviour). The first two strings in the tick label list ('a' and 'b') are then used, which is the correct (if not desired) behaviour on the part of the library.
I have made a PR to add a flag to make box_plot managing the xticks optional.
Ok. I agree that 99% of the time the x-ticks should fall under the boxes. I am also ok with boxplot grabbing the first two strings in the tick label list, rather than the two labels that previously corresponded to x =1 and x = 2. Thanks for making xtick management optional.
What about the x-axis limits? In my opinion, boxplot should not adjust user specified axis limits.
Activity
tacaswell commentedon Mar 24, 2014
Does this also happen on master?
ENH : add flag to box_plot and bxp to manage (or not) xticks
tacaswell commentedon Mar 24, 2014
You are misunderstanding how ticks/tick labels behave. When you use
set_xticksandset_xticklabelsyou are really creating 'FixedLocatorandFixedFormatter` objects. The former says 'put ticks at these places', the second says 'use this list of strings to generate the tick labels'. What is going on is that box-plot is changing the xticks so that the ticks fall under the boxes (which is 99% of the time the correct behaviour). The first two strings in the tick label list ('a' and 'b') are then used, which is the correct (if not desired) behaviour on the part of the library.I have made a PR to add a flag to make box_plot managing the xticks optional.
ENH : add flag to box_plot and bxp to manage (or not) xticks
breedlun commentedon Mar 24, 2014
Ok. I agree that 99% of the time the x-ticks should fall under the boxes. I am also ok with boxplot grabbing the first two strings in the tick label list, rather than the two labels that previously corresponded to x =1 and x = 2. Thanks for making xtick management optional.
What about the x-axis limits? In my opinion, boxplot should not adjust user specified axis limits.
tacaswell commentedon Mar 24, 2014
The call to
setlimis also under the flag (you have to do both or neither, other wise you could end up with most of the boxes not visible).ENH : add flag to box_plot and bxp to manage (or not) xticks