LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-08-2013, 09:58 PM   #1
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
gnuplot - plotting multiple files some may have no data


Subject says it. I have multiple files I need to plot overlaying each other. Some of them may be empty. Is there a way to have it ignore the "Skipping data file with no valid points" error and just continue plotting? Here is my plot statement. the 9682 and/or 967E data files may be empty, but I need to see any data in either that is there. I don't know ahead of time which, if either, will have data.

Code:
plot  './fll.dat' using 1:14 axes x1y2 title 'Integrator Err' with points \ 
        pt 5 ps .3 lc rgb "green", \ 
      './fll.dat' using 1:5 axes x1y1 title 'DAC' with lines \
         lw 1 lc rgb "blue", \
       './integ.dat' using 1:5 axes x1y1 title 'Integrator Updates' \
        with points pt 5 ps .2 lw 1 lc rgb "red", \
       './9682.dat' using 1:5 axes x1y1 title '9682 Sample' \
        with points pt 5 ps .2 lw 1 lc rgb "black", \
       './967E.dat' using 1:5 axes x1y1 title '967E Sample' \
         with points pt 5 ps .2 lw 1 lc rgb "purple"
 
Old 10-09-2013, 12:59 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Original Poster
Rep: Reputation: 141Reputation: 141
I figured out a solution so I thought I'd post it. Its seems overly complicated for what should be a simple switch in the gnuplot program. This creates two strings, $F967E and $F9682 which are appended to the part of the plot statement that always has data. If the file is empty, then the string is null for that file and no attempt is made to plot it.

In the scripting section of the script I added this:
Code:
if [ `stat --print="%s" 967E.dat` -ne 0 ]
then
   F967E=" ,\
         '967E.dat' using 1:5 axes x1y1 title '967E Sample'\
          with points pt 5 ps .2 lw 1 lc rgb \"purple\""
fi

if [ `stat --print="%s" 9682.dat` -ne 0 ]
then
   F9682=" ,\
         '9682.dat' using 1:5 axes x1y1 title '9682 Sample'\
         with points pt 5 ps .2 lw 1 lc rgb \"black\""
fi

In the gnuplot section of the script I changed this:
Code:
plot  './fll.dat' using 1:14 axes x1y2 title 'Integrator Err' with points \
        pt 5 ps .3 lc rgb "green", \
      './fll.dat' using 1:5 axes x1y1 title 'DAC' with lines \
         lw 1 lc rgb "blue", \
       './integ.dat' using 1:5 axes x1y1 title 'Integrator Updates' \
         with points pt 5 ps .2 lw 1 lc rgb "red" $F967E $F9682

Last edited by Quakeboy02; 10-09-2013 at 01:05 PM.
 
Old 10-09-2013, 12:59 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Try a google search for "gnuplot empty data points". The first three or four returns should answer your question.

The consensus seems to be: for empty data points, substitute non-numerical data such as a dash.
 
Old 10-09-2013, 01:01 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Original Poster
Rep: Reputation: 141Reputation: 141
Hi bigrigdriver. Thanks for the response. I had done many searches and found no answers. But as I was looking at my post after I made it, I realized the empty string trick would work, and so here it is, above.
 
  


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
Plotting realtime data with GNUPLOT john_erlandsson Linux - Software 3 11-04-2011 04:42 PM
[SOLVED] What plotting software should I use for Plotting ASCII data in Ubuntu? msbstar Linux - Newbie 7 04-12-2011 10:30 PM
LXer: Real Time Data Plotting with GnuPlot LXer Syndicated Linux News 0 02-03-2010 03:30 PM
gnuplot (plotting simultaneously) hanamilani Linux - Software 2 02-02-2009 12:18 AM
gnuplot - do multiple plots from data file with built-in commands Meson Linux - Software 2 07-30-2008 03:52 PM

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

All times are GMT -5. The time now is 09:08 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