Objectmix
Tags Register Mark Forums Read

gnuplot macro IMBEDDED in a gnuplot command file : Graphics

This is a discussion on gnuplot macro IMBEDDED in a gnuplot command file within the Graphics forums in Theory and Concepts category; Hi, I would like to define a macro to use in a gnuplot input file. What is important is that I would very much like to put this macro within the command file. For example, in the upper part of the file I would like to define a macro to put several plots on one page (using multiplot), then plot them once with a xrange of say [-20:80] and then plot another page with an expanded range, say [60:80], on all of the plots. So one might hope for a command file that is like define macro CONVENIENT_PLOT followed by ...


Object Mix > Theory and Concepts > Graphics > gnuplot macro IMBEDDED in a gnuplot command file

Reply

 

LinkBack Thread Tools
  #1  
Old 12-17-2007, 05:21 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default gnuplot macro IMBEDDED in a gnuplot command file

Hi,

I would like to define a macro to use in a gnuplot input file. What
is important is that I would very much like to put this macro within
the command file. For example, in the upper part of the file I
would like to define a macro to put several plots on one page (using
multiplot), then plot them once with a xrange of say [-20:80] and then
plot another page with an expanded range, say [60:80], on all of the
plots. So one might hope for a command file that is like

define macro CONVENIENT_PLOT followed by many lines for the
definition
set xrange [-20:80]; CONVENIENT_PLOT
set xrange [60;80]; CONVENIENT_PLOT

I know this is easy if I am willing to make a separate file and just
load the file, but for data management purposes, I really only want
one file. I suspect this is not possible in the present version of
gnuplot, but would be happy to find that I am wrong,

Thanks in Advance,
Alfred Baron



  #2  
Old 12-17-2007, 11:57 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: gnuplot macro IMBEDDED in a gnuplot command file

In article <afe56d60-b72e-45e1-8c1b-b328ad0fdc0f@b1g2000pra.googlegroups.com>,
<baron@spring8.or.jp> wrote:
>Hi,
>
>I would like to define a macro to use in a gnuplot input file. What
>is important is that I would very much like to put this macro within
>the command file. For example, in the upper part of the file I
>would like to define a macro to put several plots on one page (using
>multiplot), then plot them once with a xrange of say [-20:80] and then
>plot another page with an expanded range, say [60:80], on all of the
>plots. So one might hope for a command file that is like
>
> define macro CONVENIENT_PLOT followed by many lines for the
>definition
> set xrange [-20:80]; CONVENIENT_PLOT
> set xrange [60;80]; CONVENIENT_PLOT


See "help macros"



--
Ethan A Merritt
  #3  
Old 12-18-2007, 05:23 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: gnuplot macro IMBEDDED in a gnuplot command file

On Dec 18, 1:57 am, merr...@u.washington.edu (Ethan Merritt) wrote:
>
> See "help macros"
>
> --
> Ethan A Merritt


Ethan,

Thanks much, but while that looks like it is fine for simple things I
was not able to make it work for more complicated ones.
The macro I would like to repeat is something like

#start of macro CONVENIENT_PLOT
set multiplot
set origin 0,0; set size 1,0.5
plot "datfile1.dat" u 1:2:3 t "datfile1 details" w e
set origin 0,0.5
plot "datafile2.dat" u 1:2:3 t "datafile2 details" w e
set nomultiplot
# end macro
# note repeating part is typically 50 to 100 lines

#then plot one page with
set xrange [-20:80]; CONVENIENT_PLOT
#next page with different x range
set xrange [60;80]; CONVENIENT_PLOT

I am not seeing how to do this with a string definition and an @
sign...
If I am missing something, can you kindly be a bit more explicit?

Thanks,
AB
  #4  
Old 12-18-2007, 11:18 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: gnuplot macro IMBEDDED in a gnuplot command file

In article <8f5dbf4a-2de7-41a2-a9ba-91cf67209157@s12g2000prg.googlegroups.com>,
AB <baron@spring8.or.jp> wrote:
>On Dec 18, 1:57 am, merr...@u.washington.edu (Ethan Merritt) wrote:
>>
>> See "help macros"

>
>Thanks much, but while that looks like it is fine for simple things I
>was not able to make it work for more complicated ones.
># note repeating part is typically 50 to 100 lines


OK, then how about:

# Write repetitive part to a temporary file
set print "macro.tmp"
print "First line of macro"
print "Second line of macro"
....
print "100th line of macro"
unset print

# Execute main body of the operation
....
load "macro.tmp"
....
load "macro.tmp"
....
--
Ethan A Merritt
  #5  
Old 12-19-2007, 01:05 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: gnuplot macro IMBEDDED in a gnuplot command file

Ethan,

Looks like it works. Now I must decide between relative utility of
having two different formats (one of which is not executable) as
compared to the repetitive code. But that is not your problem!

Thank you for the help.

AB


On Dec 19, 1:18 am, merr...@u.washington.edu (Ethan Merritt) wrote:
> In article <8f5dbf4a-2de7-41a2-a9ba-91cf67209...@s12g2000prg.googlegroups.com>,
>
> AB <ba...@spring8.or.jp> wrote:
> >On Dec 18, 1:57 am, merr...@u.washington.edu (Ethan Merritt) wrote:

>
> >> See "help macros"

>
> >Thanks much, but while that looks like it is fine for simple things I
> >was not able to make it work for more complicated ones.
> ># note repeating part is typically 50 to 100 lines

>
> OK, then how about:
>
> # Write repetitive part to a temporary file
> set print "macro.tmp"


> load "macro.tmp"
> ...
> load "macro.tmp"
> ...
> --
> Ethan A Merritt

Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
gnuplot from bash command line usenet Graphics 2 11-16-2007 10:30 AM
How to edit an eps-gnuplot-file? usenet Graphics 1 09-17-2007 11:42 AM
Problem with text layout in the gnuplot buffer of gnuplot mode in xemacs usenet Graphics 0 10-19-2006 05:05 PM
'load ' command in gnuplot usenet Graphics 3 03-06-2006 01:36 PM
how to write gnuplot output to file usenet Graphics 2 01-06-2006 07:58 AM


All times are GMT -5. The time now is 08:52 AM.

Managed by Infnx Pvt Ltd.