Matplotlib Errorbar Caps Missing

后端 未结 3 1821
你的背包
你的背包 2020-12-01 15:54

I\'m attempting to create a scatter plot with errorbars in matplotlib. The following is an example of what my code looks like:

import matplotlib.pyplot as pl         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 16:28

    What worked for me was adding this (as per: How to set the line width of error bar caps, in matplotlib):

    (_, caps, _) = plt.errorbar(x,y, yerr=err, capsize=20, elinewidth=3)
    
    for cap in caps:
        cap.set_color('red')
        cap.set_markeredgewidth(10)
    

提交回复
热议问题