From: Peter G. <pgr...@ge...> - 2004-09-28 02:37:29
|
Hi: Want to inquire about gnuplot's 'steps' like functionality in matplotlib's plotting. A good example is show here: http://chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/steps.htm In a most hack-ish way possible, for the sake of testing I tried this (modified simple_plot.py example): -------------- #!/usr/bin/env python from matplotlib.matlab import * figure(1) t = arange(0.0, 1.0, 0.01) s = sin(2*2*pi*t) t2=concatenate((t[1:], array([t[-1]])), 1) s2=concatenate((array([s[0]]), s[:-1]), 1) hlines(s, t, t2) vlines(t, s, s2) gca().autoscale_view() #Using 60.2; need to call this for the the parts below y=0 to be visible xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks')' grid(True) #axis([0,1,-1,1]) savefig('simple_plot') show() ------------- It seems to work quite nicely, but I think an ideal way of doing this would be to incorporate it into the plot() command. Perhaps adding an option 'steps' (following gnuplot's convention could have steps equal 'histeps', 'fsteps' or just 'steps' - see link above.. None could mean regular plot() behavior). I would say this would be the most elegant option, but probably would call for John (or someone else from the core developers) to make the changes. Alternatively we could use above and wrap it in a plot_step() function. Any interest in this? If so which way do we want to go? Peter |