Thanks to visit codestin.com
Credit goes to github.com

Skip to content

boxplot in version 1.4.0 does not respect property settings for fliers (flierprops) #3459

Closed
@salspaugh

Description

@salspaugh

Minimum amount of code to reproduce the bug:

import matplotlib.pyplot as plt

x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56]
flierprops = dict(marker='o', markerfacecolor='green', markersize=12, linestyle='none')
plt.boxplot(x, flierprops=flierprops)
plt.show()

This produces
buggy-boxplot

Note the flier is a large blue plus sign, not a green circle as specified by flierprops.

This happens with Python 2.7.8 and matplotlib 1.4.0 -- haven't tested other situations.

This bug does not seem to be dependent upon the particular choice of flierprops but I haven't exhaustively tested this.

Notably, this broken example can also be found in the boxplot demo code: http://matplotlib.org/examples/statistics/boxplot_demo.html

The relevant code at that page is shown in the third line at the top and the last two lines at the bottom of this image:

boxplot-demo-code

And the demo graph that results from this demo code is also broken in the same way as the first example -- a large blue plus is shown instead of the specified symbol:

boxplot-demo-broken-result

Lastly, note that if the the sym argument is provided that specifies the symbol desired, boxplot does seem to respect flierprops. Code example:

import matplotlib.pyplot as plt

x = [0.15, 0.11, 0.06, 0.06, 0.12, 0.56]
flierprops = dict(marker='o', markerfacecolor='red', markersize=16, linestyle='none')
plt.boxplot(x, flierprops=flierprops, sym='o') # Added sym argument!
plt.show()

Result:
buggy-boxplot-fix

If this is the intended fix or correct way to use this function, this should be made clear in the documentation and in the demo code.

Justification for this issue: There were closed issues related to this, but one seemed to involve some debate about defaults and the other seemed to concern only lower values. The bug reported here is not a problem with defaults nor just with lower fliers. Couldn't find other potential duplicates but apologies if that is the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions