Closed
Description
The colors of the symbols in my legend vary randomly each time I make a plot or save it to disk. It shifts between a set of three colors, one of which is completely correct, one of which has a single incorrect color, and one which is all wrong. Run the demo code below several times to see this. I have reproduced this on two separate machines, one of which is running the code in a Docker container.
I have noticed the Please do not ask for support with these customizations active.
but since it lists nothing, I'm not sure what to make of that.
matplotlib version: 1.4.3
backend: Qt5Agg version 5.3.2
import matplotlib.pyplot as plt
import random
blue = [.365, .647, .855]
green = [.376, .741, .408]
purple = [.698, .463, .698]
def boxplot(data, title, x_label, y_label, legend_location="upper left"):
fig = plt.figure(1, figsize=(9, 6))
ax = fig.add_subplot(111)
meanprops = dict(linestyle='-', linewidth=1.5, color=purple)
boxprops = dict(linewidth=1.5, color=blue)
whiskerprops = dict(linewidth=1.5, color=blue)
capprops = dict(linewidth=1.5, color=blue)
medianprops = dict(alpha=0.0)
flierprops = dict(marker='+', color=green, markersize=12, mew=2)
plt.plot([], c=purple, label='Mean', linewidth=1.5)
plt.plot([], c=blue, label='1st Quartile', linewidth=1.5)
plt.plot([], c=blue, label='3rd Quartile', linewidth=1.5, linestyle='--')
plt.legend(loc=legend_location, numpoints=1)
plt.plot([], c=green, label='Outlier', marker='+', markersize=12, mew=2, linestyle='')
plt.legend(loc=legend_location, numpoints=1)
values = [a for d in data.values() for a in d]
max_value = max(values)
bp = ax.boxplot([d for n, d in sorted(data.items())],
meanprops=meanprops,
capprops=capprops,
flierprops=flierprops,
medianprops=medianprops,
boxprops=boxprops,
whiskerprops=whiskerprops,
showmeans=True,
meanline=True,
labels=[i for i in range(49)])
ax.set_ylim([0, max_value + 2])
ax.set_axis_bgcolor('white')
ax.set_xlabel(x_label)
ax.set_ylabel(y_label)
plt.suptitle(title)
fig = plt.gcf()
fig.set_size_inches(20, 10)
plt.show()
plt.close()
if __name__ == '__main__':
data = {j: [random.randint(10, 100) for i in range(100)] for j in range(49)}
boxplot(data, "Race Condition Plots", "X Axis", "Y Axis")
$ python3.4 /opt/bug.py --verbose-helpful
non-network local connections being added to access control list
$HOME=/root
matplotlib data path /usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data
*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:
Please do not ask for support with these customizations active.
*****************************************************************
loaded rc file /usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.4.3
verbose.level helpful
interactive is False
platform is linux
CACHEDIR=/root/.cache/matplotlib
font search path ['/usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/fonts/ttf', '/usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/fonts/afm', '/usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
generated new fontManager
backend Qt5Agg version 5.3.2
1.4.3
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
Unrecognized line style none, <class 'str'>
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans ('/usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf') with score of 0.000000
findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large to Bitstream Vera Sans ('/usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf') with score of 0.000000
Metadata
Metadata
Assignees
Labels
No labels