[英]Matplotlib Error Bars
If I run this code: 如果我运行此代码:
plt.scatter(n, y, marker ='^', s = 30, color = 'k')
plt.errorbar(n, y, yerr=yerror)
plt.ylim(ymin = 5, ymax = 20)
The resulting graph has a red line between the scatterplot. 结果图在散点图之间有一条红线。 How do I prevent this line from appearing?
如何防止此行出现? Additionally, how might I add caps to the error bars?
此外,如何在错误栏中添加上限?
I have tried 我努力了
(_, caps, _) = plt.errorbar(n,y, yerr=yerror, capsize=5, elinewidth=3)
for cap in caps:
cap.set_color('k')
cap.set_markeredgewidth(3)
and 和
plt.errorbar(n, y, yerr = yerror, ecolor = 'k', capsize = 5)
But neither has worked. 但是都没有奏效。 There is clearly something fundamental I am missing about errorbars.
显然我缺少关于错误栏的一些基本知识。
After further searching (almost immediately after I posted the question) I have found that adding 进一步搜索后(几乎在我发布问题之后),我发现
ls = 'none'
within 内
plt.errorbar(n, y, yerr=yerror, ls = 'none')
will solve the issue. 将解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.