[Matplotlib-users] Ensure vertical lines start from x-axis

2009-05-25 Thread collern2

I'm trying to have the points start from the x-axis (similar to a histogram)
and draw lines upwards. I've attached an image of the program output, as you
can see - there are no red lines from 0-200 on the y-axis. Any ideas how to
start them from zero?

http://www.nabble.com/file/p23707480/image.png 

Sample value from list entry for time[]
693596.03
Sample value from list entry for latency[]
1043

#
Sample Code
#


def plot_graph():

# Plotting the graph
plt.plot(time[5300:],latency[5300:], 'r-', linewidth=0.15)

# Define the axes
y_label = [0, 200, 400, 600, 800, 1000, 1200]
plt.axes().set_xlim(xmin=datetime.datetime(1900,1,1,0,0,0,0),
xmax=time[-1])
plt.axes().set_ylim(ymin=0, ymax=1400)
plt.axes().set_xticklabels(time, fontdict=None, minor=False, size=10)
plt.axes().set_yticklabels(y_label, fontdict=None, minor=False, size=10)

# Labeling the graph
ax = p.subplot(111)
ax.xaxis.set_major_locator(MaxNLocator(7))
plt.gca().xaxis.set_major_formatter(DateFormatter('%M:%S'))
plt.xlabel(x_axis)
plt.ylabel(y_axis)
plt.title(title)

# Grid
plt.grid(True)
plt.grid(alpha=0.1, color='black', linestyle='-', linewidth=0.1)
plt.savefig(figure)

# plot the graph
plot_graph()
-- 
View this message in context: 
http://www.nabble.com/Ensure-vertical-lines-start-from-x-axis-tp23707480p23707480.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ensure vertical lines start from x-axis

2009-05-25 Thread John Hunter
On Mon, May 25, 2009 at 9:02 AM, collern2 noel.colle...@gmail.com wrote:

 I'm trying to have the points start from the x-axis (similar to a histogram)
 and draw lines upwards. I've attached an image of the program output, as you
 can see - there are no red lines from 0-200 on the y-axis. Any ideas how to
 start them from zero?

 http://www.nabble.com/file/p23707480/image.png

 Sample value from list entry for time[]
 693596.03
 Sample value from list entry for latency[]
 1043

 #
 Sample Code
 #


 def plot_graph():

 # Plotting the graph
    plt.plot(time[5300:],latency[5300:], 'r-', linewidth=0.15)

It sounds like you want vlines

  http://matplotlib.sourceforge.net/search.html?q=codex+vlines
  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.vlines

Eg,

  plt.vlines(time[5300:], 0, latenc[5300:], color='red', lw=0.15)

JDH

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ensure vertical lines start from x-axis

2009-05-25 Thread Alan G Isaac
What is the right way to produce date-range bars,
like the recession bars in
http://research.stlouisfed.org/fred2/series/TB3MS?cid=116

Thanks,
Alan Isaac

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ensure vertical lines start from x-axis

2009-05-25 Thread John Hunter
On Mon, May 25, 2009 at 12:35 PM, Alan G Isaac alan.is...@gmail.com wrote:
 What is the right way to produce date-range bars,
 like the recession bars in
 http://research.stlouisfed.org/fred2/series/TB3MS?cid=116


axvspan.  See

  
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.axvspan
  http://matplotlib.sourceforge.net/examples/pylab_examples/axhspan_demo.html

JDH

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ensure vertical lines start from x-axis

2009-05-25 Thread Alan G Isaac
 On Mon, May 25, 2009 at 12:35 PM, Alan G Isaac alan.is...@gmail.com wrote:
 What is the right way to produce date-range bars,
 like the recession bars in
 http://research.stlouisfed.org/fred2/series/TB3MS?cid=116



On 5/25/2009 1:45 PM John Hunter apparently wrote:
 axvspan.  See
 
   
 http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.axvspan
   http://matplotlib.sourceforge.net/examples/pylab_examples/axhspan_demo.html


Great!
Thanks,
Alan

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users