Plotting logging data with dates

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plotting logging data with dates

Kipton Moravec
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


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Plotting logging data with dates

Paul Hobson-2
This is a long list of topics that you're asking about, and a lot of it isn't very clear. I would head over to pandas.pydata.org to learn about basic time series plotting and resampling.

We can probably better help you if you ask about a specific problem. 

On Tue, Mar 19, 2019 at 6:23 PM Kipton Moravec <[hidden email]> wrote:
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


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Plotting logging data with dates

Jerzy Karczmarczuk-2
In reply to this post by Kipton Moravec


Le 20/03/2019 à 02:22, Kipton Moravec a écrit :
I am new and have been reading and playing with the tutorials.  I have not seen what I need to do.
...

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

The user wants to look ...

"The user"... - I read this as the evidence that you are doing some work for somebody else. And yet, you demand that the matplotlib list solves ALL your problems?? 

Perhaps, instead of "playing with tutorials" you read the documentation, e.g.

https://matplotlib.org/gallery/text_labels_and_annotations/date.html
https://pythonspot.com/plot-time-with-matplotlib/

and some stackOverflow pages about months plotted with Matplotlib.

There is PLENTY of information about plotting temporal data. Such formulations as "I do not know what might work." is not a way to ask for a professional help. Google (despite all...) is still your friend. I found almost immediately about 20 relevant pages, and I am sure you can do it yourself as well.

(And, of course, Pandas has a full section on this sort of data)

Jerzy Karczmaczuk



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Plotting logging data with dates

Kipton Moravec

Thanks, I did not know what to ask for to Google.

I did not expect anyone to solve all my problems, and I was reading the documentation, and playing with the tutorials. I was reading the matrplotlib Users Guide. That was the documentation, and I did not see anything about plotting time. So I must have missed it. https://matplotlib.org/users/index.html

I never heard of Pandas or pythonspot.


I am doing this for my Amateur Radio Club, I am the Communications Director and maintain the repeater. So we are monitoring different things so we can see what changes over time, and see if something is about to fail. And when I said user I meant the person looking at the graphs on a web page.

And when I said I do not know what might work, it is because I do not know enough to know what my options or trade-offs are or what it will look like. 

When you are doing a year it makes sense to have a vertical line every month.

When you are doing a week it makes sense to have a vertical line at midnight every day.

When you are doing a day a line every hour seems like too much. Maybe once every 3 hours maybe every 6 hours, or something else.

Same with doing a month. How do you plot it so you know where you are? A vertical line every midnight seems too often. Maybe every 7 days (7, 14, 21, 28)? Maybe every Sunday? I do not know what will look good until I try a few different ways and see what is most pleasing. And what is pleasing to me may not be good for you. I have not seen any plots like this that make me say "that is what it should look like".

Thanks to you and Paul I have a direction to look, and the terminology. That is all I really need.

And take it easy on the new guy...

Kip

On 3/20/19 5:04 AM, Jerzy Karczmarczuk wrote:


Le 20/03/2019 à 02:22, Kipton Moravec a écrit :
I am new and have been reading and playing with the tutorials.  I have not seen what I need to do.
...

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

The user wants to look ...

"The user"... - I read this as the evidence that you are doing some work for somebody else. And yet, you demand that the matplotlib list solves ALL your problems?? 

Perhaps, instead of "playing with tutorials" you read the documentation, e.g.

https://matplotlib.org/gallery/text_labels_and_annotations/date.html
https://pythonspot.com/plot-time-with-matplotlib/

and some stackOverflow pages about months plotted with Matplotlib.

There is PLENTY of information about plotting temporal data. Such formulations as "I do not know what might work." is not a way to ask for a professional help. Google (despite all...) is still your friend. I found almost immediately about 20 relevant pages, and I am sure you can do it yourself as well.

(And, of course, Pandas has a full section on this sort of data)

Jerzy Karczmaczuk



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Plotting logging data with dates

Jerzy Karczmarczuk-2

Le 21/03/2019 à 01:47, Kipton Moravec explains his situation, including :

I did not know what to ask for to Google.

OK, my last attempt to try to help you, since it is really a task, to help somebody who doesn't know what he wants, concretely... You asked in your first post:

For the plot of the day, probably a vertical line every hour and a label every 3 hours.
So, I issued a Google query "matplotlib For the plot of the day, probably a vertical line every hour and a label every 3 hours". Just it. More than 600 000 results in 0.75 seconds. Some examples:

Labeling time series - All this - Dr. Drang -- some codes to lookup

4. Visualization with Matplotlib - Python Data Science Handbook [Book] -- a really comprehensive chapter with plenty of time labelled graphs

... many others, e.g.

Python Plotting With Matplotlib (Guide) – Real Python -- a series of reasonable, even if superficial tutorials on many Python related issues, this one includes also some plotting with Pandas.

Top 50 matplotlib Visualizations - The Master Plots (w/ Full Python code) -- many, many examples of plots with very different label styles, including time-related data. Inspire yourself.

====== etcEtcEtcEtc...

I don't cite the URLs, since you might choose a different question from your catalog (or repeat this above) yourself.

Jerzy Karczmarczuk



_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users