我有一个六轴matplotlib图,我想在整个图上绘制一条简单的水平红线,x = 2。那可能吗 ?
我看到了这个:Matplotlib: Can a plot a line from one set of axes to another?这很有希望,但有点复杂 - 还有另一种更简单的方法吗?
fig , axes = plt.subplots(1,6)
iteration = -1
for label, group in X.groupby(["quantile_Y"])["FTE"]:
iteration +=1
to_draw = axes[iteration]
local_title = "Y < "+label[label.find(",")+2:-5]
group.plot(kind = "box" ,
ax = to_draw ,
ylim = (0,5) ,
title = local_title )
to_draw.label_outer()
to_draw.set_axis_bgcolor("white")
to_draw.plot([0,0], [10,10])
plt.show()`
这给了我:
很明显,x = 2处的直线可能很有用;)