def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- from numpy import linspace, sin x = linspace(-10, 10, 200) dy = x / 100.0 y = sin(sin(sin(x))) x2 = linspace(-10, 10, 20) y2 = sin(sin(sin(x2))) curve2 = make.curve(x2, y2, color="g", curvestyle="Sticks") curve2.setTitle("toto") plot( make.curve(x, y, color="b"), curve2, make.curve(x, sin(2 * y), color="r"), make.merror(x, y / 2, dy), make.label("Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"), make.marker(position=(5.0, 0.8), label_cb=lambda x, y: "A = %.2f" % x, markerstyle="|", movable=False), )
def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- from numpy import linspace, sin x = linspace(-10, 10, 200) dy = x / 100.0 y = sin(sin(sin(x))) x2 = linspace(-10, 10, 20) y2 = sin(sin(sin(x2))) curve2 = make.curve(x2, y2, color="g", curvestyle="Sticks") curve2.setTitle("toto") plot( make.curve(x, y, color="b"), curve2, make.curve(x, sin(2 * y), color="r"), make.merror(x, y / 2, dy), make.label("Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"), make.marker( position=(5.0, 0.8), label_cb=lambda x, y: "A = %.2f" % x, markerstyle="|", movable=False, ), )
def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- from numpy import linspace, sin x = linspace(-10, 10, 200) dy = x / 100.0 y = sin(sin(sin(x))) x2 = linspace(-10, 10, 20) y2 = sin(sin(sin(x2))) plot( [ make.curve(x, y, color="b"), make.label( "Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR" ), ], [ make.curve(x2, y2, color="g"), ], [ make.curve(x, sin(2 * y), color="r"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"), ], [ make.merror(x, y / 2, dy), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"), ], )
def errorbar(*args, **kwargs): """ Plot curves with error bars Example: import numpy as np x = np.linspace(-5, 5, 1000) errorbar(x, -1+x**2/20+.2*np.random.rand(len(x)), x/20) show() """ axe = gca() curve = make.merror(*args, **kwargs) axe.add_plot(curve) _show_if_interactive() return [curve]
def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- from numpy import linspace, sin x = linspace(-10, 10, 200) dy = x/100. y = sin(sin(sin(x))) x2 = linspace(-10, 10, 20) y2 = sin(sin(sin(x2))) plot([make.curve(x, y, color="b"), make.label("Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR"),], [make.curve(x2, y2, color="g"), ], [make.curve(x, sin(2*y), color="r"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"),], [make.merror(x, y/2, dy), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"),] )