简体   繁体   中英

Marker edge colors or just other markers of matplotlib.axes.Axes.errorbar (Python Package) to every point

Is there any way to use color markers of matplotlib.axes.Axes.errorbar (Python Package), or just other markers, to every point?

Example:

err = np.array([0.0, math.log(0.0423746910453,10), math.log(0.26659516937,10)])

plt.errorbar(x,y,yerr=err,marker='^',markeredgecolor='gray')

I would like to have a color marker, or just other marker, to every point (error).

  • Point 1: 0.0 -> markeredgecolor='red', or marker='^'
  • Point 2: math.log(0.0423746910453,10) -> markeredgecolor='blue', or marker='X'
  • Point 3: math.log(0.26659516937,10) -> markeredgecolor='green', or marker='o'

I'm not sure if there matplotlib supports this natively, however you can simply workaround this limitation:

First, draw the line connecting the points with plt.plot(x, y) . You can then draw each marker separately by calling plt.errorbar for each point with different options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM