Hi Ben,

I tried including the date info into my data files as you suggested and it
works! Thank you very much for help.

Regards,
Clare.

On Mon, Jun 18, 2012 at 9:10 PM, Benjamin Root <ben.r...@ou.edu> wrote:

>
>
>  On Mon, Jun 18, 2012 at 6:42 AM, Clare Soh <clare07112...@gmail.com>wrote:
>
>> Hi,
>>
>> I'm trying to plot some data against time using the following code:
>>
>>             r = mlab.csv2rec(filename)
>>             self.axis.plot(r.time, r.jb_sizems)
>>             hfmt = dates.DateFormatter('%H:%M:%S.%f')
>>             self.axis.xaxis.set_major_formatter(hfmt)
>>             self.axis.set_title("JB Size")
>>             self.axis.set_xlabel("Time")
>>             self.axis.set_ylabel("JB Size(ms)", color='b')
>>             self.axis.set_ylim(bottom=0)
>>             for tl in self.axis.get_yticklabels():
>>                 tl.set_color('b')
>>             self.axis.grid()
>>             self.figure.autofmt_xdate()
>>
>> Everything works well, except for the cases when time ranges from before
>> 12am to after 12am. For example I have one csv file with time values
>> ranging from 23:04:09.367000 to 00:08:09.357000. By right I should see a 1
>> hour plot with x-axis ranging from 23:xx:xx.xxxxxx on the left to
>> 00:xx:xx.xxxxxx on the right, but I got a "24 hour" plot instead with
>> x-axis ranging from 00:xx:xx.xxxxxx on the left to 23:xx:xx.xxxxxx on the
>> right. My graph therefore appeared "chopped" into 2. Anybody knows how to
>> fix this?
>>
>> Regards,
>> Clare.
>>
>>
> Clare,
>
> Without a date, this can not be handled the way you want.  You can either
> make it go from least to greatest or greatest to least.  Using just hours,
> you will either have to increase from 00Z to 23Z, or decrease from 23Z to
> 00Z.  If you can't get a date included into the data file, you will
> probably have to do some processing of your data to add some sort of "fake"
> date to it first.  This can be very tricky to do correctly.  Your best bet
> is to get your data files to report the date.
>
> I hope this helps!
> Ben Root
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to