[Matplotlib-users] Ensure vertical lines start from x-axis
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
[Matplotlib-users] Issues with time display
Hi, I've managed to take the contents of my CSV file and display it with matplotlib. I'm having some issues with the way my X-axis is being displayed. For the X-axis, I pass in a list that filled with datetime objects, an example of one element on the list: datetime.datetime(2007, 12, 17, 20, 28, 15), Issues (please see the attached cpu.png: - for some reason a TZ has been inserted - graphs have white space buffers on either side of the X-axix - points on X-axis are separated by the hour, instead of values in datetime object I have tried many variations of plotdate, etc. If someone could please point me in the right direction. Thanks = Code http://www.nabble.com/file/p21958283/cpu.png = #!/usr/bin/env python import csv import sys import matplotlib.pyplot as plt import datetime new_list = [] time = [] cpu = [] fileReader = csv.reader(open(sample.csv, rb)) for row in fileReader: new_list.append(row) # Converts papatimes time format into dattime def time_split(current_line): # splits papastats datetime format in useable python list dt = datetime.datetime.strptime(current_line[0],%Y/%m/%d %H:%M:%S) time.append(dt) def cpu_calc(current_line): cpu.append(current_line[11].rstrip(%)) #Iterate over list of CSV values for i in new_list[1:]: time_split(i) cpu_calc(i) plt.plot(time, cpu, 'b-') #plt.plot_date(time, cpu, fmt='b-', xdate=False, ydate=False, tz=None) plt.xlabel('Time') plt.ylabel('CPU %') plt.title('Daily CPU Usage') plt.grid(True) plt.grid(alpha=0.2, color='black', linestyle='-', linewidth=0.1) plt.show() -- View this message in context: http://www.nabble.com/Issues-with-time-display-tp21958283p21958283.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users