该问题与 matplotlib 条形图有关。具体来说,当我绘制条形图时,有些条形不可见。
Dots and bars uses the same data series so should be in the same places
.
我不知道这个问题的根源是什么,这就是我发布这个问题的原因。
我还注意到,对于同一个图,当我将窗口放大到全屏时,缺失的条会神奇地出现
The same data series as in the first picture, just full screen window
.
当我改变绘图的颜色时也会发生同样的情况,所以假设我使用:
artist = plot.bar(x_data_series, y_data_series, color="black")
现在我有这个不完整的图表,但是当我使用时(只是之后第二次设置颜色):
artist = plot.bar(x_data_series, y_data_series, color="black")
matplotlib.artist.setp(artist, color="black")
我明白了:
Now all bars are visible
.
当我放大这个不完整的图表时,也会发生同样的情况:
Here also all bars are visible
.
更重要的是,“看不见的条”,当它们可见时,它们似乎比其他条粗一点,但是它们在艺术家属性中的宽度与您在此处看到的相同:
One of this bars is the thicker one and the other the "normal" one, both are 0.8 in width
.
只是为了向您提供更多信息,这是嵌入在 tkinter 中的图表。
以下是图形、画布和轴(父框架只是放置绘图的框架):
figure = Figure(dpi=100)
plot = figure.add_subplot(111)
canvas = FigureCanvasTkAgg(figure, parent_frame)
我找到的“解决方法”对我来说并不令人满意,我真的很想找到问题的根源,而且宽度问题是我无法弄清楚的。