LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-10-2019, 08:18 AM   #1
gregors
Member
 
Registered: Mar 2018
Posts: 177

Rep: Reputation: Disabled
[Gnuplot] Plot a log file


Hi there!

I have a log file containing lines like this:

Code:
2019-02-10 03:53:54, 24, 40
That's date and time of the log entry, temperature in °C and RH (%)

Since I like plotting log files and have done that many times I thought that it can't be that hard. But I never had to deal with date/time things and that gave me some headache yesterday ...

So this is the last version of my gnuplot-script:

Code:
#!/usr/bin/gnuplot

FN = "/home/gszaktilla/log.txt"

set terminal postscript
set output "/tmp/plot.ps"

set xlabel "Datum"
set ylabel "°C bzw. %RH"
set title FN

set format x "%Y-%m-%d %H:%M:%S"
#set xdata time

set grid

plot FN using 1:2 notitle with lines

#eof
And the response I get is

Code:
"./diag.sh", line 18: Bad format character
Is there someone who knows what format string I have to use to plot my file?

TIA

Gregor

PS: The log files I played with usually look like the ones described here: http://html.szaktilla.de/weekender/2.html

Last edited by gregors; 02-10-2019 at 08:21 AM.
 
Old 02-10-2019, 10:04 AM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,728

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Please refer to the Time/date specifiers section in the gnuplot manual at gnuplot.info

The formats you've specified for hours, minutes and seconds is not correct.
 
Old 02-10-2019, 10:10 AM   #3
gregors
Member
 
Registered: Mar 2018
Posts: 177

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Please refer to the Time/date specifiers section in the gnuplot manual at gnuplot.info

The formats you've specified for hours, minutes and seconds is not correct.
What do you think what caused yesterdays headache?! Believe it or not, I already spent some time reading docs. I am hoping that someone here knows gnuplot good enough to tell me what the problem is.

Regards,

Gregor
 
Old 02-10-2019, 10:26 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,728

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
I appreciate the frustration.
I had to look it up. Took me about 2 minutes.
I pointed you at the specific place in the documentation...

Code:
Time Specifiers
Format     Explanation
%tH     +/- hours relative to time=0 (does not wrap at 24)
%tM     +/- minutes relative to time=0
%tS     +/- seconds associated with previous tH or tM field
gnuplot is extremely complex...as it needs to be for the functionality it provides.
Bookmark the handbook...

Last edited by scasey; 02-10-2019 at 10:28 AM.
 
Old 02-10-2019, 10:44 AM   #5
gregors
Member
 
Registered: Mar 2018
Posts: 177

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
I appreciate the frustration.
gnuplot is extremely complex...as it needs to be for the functionality it provides.
Bookmark the handbook...
Thanks a lot!

The docs I read didn't mention the t after the percent sign. I'll re-read and double check I didn't overlook something.

Gregor
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] making a gnuplot 3d graph or gnuplot fence plot Rinndalir Programming 3 10-23-2015 01:10 PM
GNUplot - plot a subset of a data column MALDATA Linux - Software 2 03-11-2015 12:11 PM
Drawing vertical AND horizonal lines in a single gnuplot plot Daravon Linux - Software 0 07-22-2009 04:22 PM
gnuplot - plot horizontal line over shorter range than the axis Meson Linux - Software 5 10-18-2008 08:41 AM
in gnuplot; move title in plot command? shengchieh Linux - Software 0 12-29-2004 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration