pandas - How to remove connecting area in fill_between() using Python and MatPlot -


i graphing +-2 standard deviations mean on graph (the green points). however, rather have straight vertical lines on top of each x-mean, because there connecting shade area between states misleading. how can this? i've tried , can't figure out. in advance. (since i'm new stack overflow can't post image of graph unfortunately.)

plt.scatter(x= joined.index.values, y = joined.poll_mean, color = "g") plt.scatter(x= joined.index.values, y = joined.spread,color = joined.color)       plt.fill_between(joined.index,(joined.poll_mean + 2*joined.poll_std).values, (joined.poll_mean - 2*joined.poll_std).values, color='g', alpha = .3) plt.xticks(joined.index.values, joined.state.values, rotation='vertical') 

are trying error bars? there matplotlib package that.

an example piece of code (from here):

import numpy np import matplotlib.pyplot plt  # example data x = np.arange(0.1, 4, 0.5) y = np.exp(-x)  # example variable error bar values yerr = 0.1 + 0.2*np.sqrt(x) xerr = 0.1 + yerr  # first illustrate basic pyplot interface, using defaults possible. plt.figure() plt.errorbar(x, y, xerr=0.2, yerr=0.4) plt.title("simplest errorbars, 0.2 in x, 0.4 in y") 

also tip, people better you, provide code can reproduce problem in full.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -