[Matplotlib-users] Plotting logging data with dates

Kipton Moravec kip at kdream.com
Tue Mar 19 21:22:25 EDT 2019


I am new and have been reading and playing with the tutorials.  I have 
not seen what I need to do.

I am collecting data on some machines every second. I collect 
temperature, input voltage, and percentage of the time on. It is two 
machines (for time on),  4-8 temperatures, and 4 voltages.

it comes to me as a csv file or line, with Date, time, and then all the 
values comma separated.

I can rearrange the data to however Matplotlib requires in Python. That 
is not the issue.

I do not know how to plot the date/time x-axis.

The user wants to look at the past hour, past day, past week, past 
month, and past year.

For the plot of the last hour I need a line and the time every 10 
minutes on the x axis.

For the plot of the day, probably a vertical line every hour and a label 
every 3 hours.

For the plot of the week, a line at midnight, and a day label between 
the lines.

For the plot of the month, I do not know what might work.

For the plot of the year, a line between the month and the month between 
the lines.

I want all the data (or a good portion of it) between the axis markers.

How do I do this, or find examples or documentation on how to work with 
time and dates for the x-axis?

I found 
https://blog.mafr.de/2012/03/11/time-series-data-with-matplotlib/ which 
helped me a lot. I did not know about strpdate2num.  But I think I need 
a date&time equivalent. Is there such a thing? Where would I find it? Or 
do I have to make it?

I had a friend suggest going with MRTG because it produces the graphs 
clost to what I want. That looked harder.

People log data by time and date and graph it all the time. Something 
like this has got to have been done before.

Kip




More information about the Matplotlib-users mailing list