|
From: Gianfranco D. <g....@in...> - 2010-11-10 16:50:11
|
Dear mpl users, I have the following problem to solve. Imagine to have the simple example reported on website plotting the errorbars of some x,y data: #!/usr/bin/env python import numpy as np import matplotlib.pyplot as 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 where possible. plt.figure() plt.errorbar(x, y, xerr=0.2, yerr=0.4) ================================================ Now I change the last line into: p = plt.errorbar(x, y, xerr=0.2, yerr=0.4) and if I change, for instance, y: y = y/2. I can easily replace the x,y with: p[0].set_data(x,y) but I do not know how to do the same for the errorbars. I need to do this as I am implementing a code with a GUI written in PyQt4, and I need to quickly replot some data. Can anyone help me? Many thanks in advance Gianfranco Durin |