source filename as parameter

View: New views
12 Messages — Rating Filter:   Alert me  

source filename as parameter

by CarloG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My main purpose is to exploit as data source a different file each time I invoke gnuplot from a script.

I would like to provide the source file name as a parameter.
For example:
gnuplot my_gnuplot_file data_source_filename

If it is not possible,
I would like to read from gnuplot the content of a text file where the filename is stored,
e.g., assigning to a variable the output of a cat/awk invocation.

Could you suggest me how to achieve it?

Thank you very much,
Carlo


Re: source filename as parameter

by Dr. Ing. Dieter Jurzitza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Carlo,
you cannot provide the data filename on the commandline because it contains no
information what to do.
However, you can have a set of scripts (or a sequence of scripts or
whatever ...)
you call

gnuplot <myscript1>

where
<myscript1>
is any ascii file containing formatting information and the file you want to
plot from. Say you want to plot the first column of "mydata.dat" vs. the
second column of "mydata.dat" you would create a file, say "mydata.plt" that
contains

*********************
plot "mydata.dat" using 1:2 w l lw 2
*********************

(just for example)

If you are on linux (or unix) you could write

*********************
#!/usr/bin/gnuplot
plot "mydata.dat" using 1:2 w l lw 2
*********************

into mydata.plt, make this file executable (chmod 0755 mydata.plt) and call
it - the only thing you have to make sure is that the path to gnuplot fits
your situation.
Hope this helps,
take care



Dieter Jurzitza


--
-----------------------------------------------------------

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------Am Sonntag, 28.
Dezember 2008 23:24:39 schrieb CarloG:
> My main purpose is to exploit as data source a different file each time I
> invoke gnuplot from a script.
>
> I would like to provide the source file name as a parameter.
*****

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Plotting in Winxp

by 4JRY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I just found this program gnuplot and this forum.  I have a quick simple
question.  Can gnuplot be used as a plotter driver to plot files made in
AutoCAD LT?  In other words can an AutoCAD output file (.PLT, .DXF, .DWG
) be plotted using gnuplot?

I have tried without success to do this.  However, I haven't tried it
directly to the plotter.  I used the 'windows' terminal for test purposes.

The reason I ask is, my old plotter, HP7475A, had a driver for win98 but
none for Winxp.  The only driver program I found costs $260, which is 10
times more than the plotter's worth.  Looking for a way to use my old
plotter in WinXP with AutoCAD LT.

JohnY



------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: Plotting in Winxp

by Dr. Ing. Dieter Jurzitza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John,
unfortunately I think you're on a wrong track. gnuplot is not a driver, it is
a function plotter (among many other things). You may create graphs from
binary or ascii input data - but the data created from AutoCAD are not
readable from gnuplot AFAIK.
Take care



Dieter Jurzitza

--
-----------------------------------------------------------

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------Am Montag, 29.
Dezember 2008 05:35:37 schrieb John Yells:
> Hi All,
>
> I just found this program gnuplot and this forum.  I have a quick simple
*****

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: Plotting in Winxp

by Tatsuro MATSUOKA-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

At gnuplot prompt
type 'set term' as

gnuplot> set term

Available terminal types:
              cgm  Computer Graphics Metafile
            corel  EPS format for CorelDRAW
           dpu414  Seiko DPU-414 thermal printer [small medium large]
             dumb  ascii art for anything that prints text
              dxf  dxf-file for AutoCad (default size 120x80)
            eepic  EEPIC -- extended LaTeX picture environment
              :
              :
You may find dxf terminal.  I have no experience to use it so that no further reply cannot be made.

Regards

Tatsuro
                 



--- John Yells <jryells@...> wrote:

> Hi All,
>
> I just found this program gnuplot and this forum.  I have a quick simple
> question.  Can gnuplot be used as a plotter driver to plot files made in
> AutoCAD LT?  In other words can an AutoCAD output file (.PLT, .DXF, .DWG
> ) be plotted using gnuplot?
>
> I have tried without success to do this.  However, I haven't tried it
> directly to the plotter.  I used the 'windows' terminal for test purposes.
>
> The reason I ask is, my old plotter, HP7475A, had a driver for win98 but
> none for Winxp.  The only driver program I found costs $260, which is 10
> times more than the plotter's worth.  Looking for a way to use my old
> plotter in WinXP with AutoCAD LT.
>
> JohnY
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gnuplot-info mailing list
> Gnuplot-info@...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>


--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Plotting in WinXP

by 4JRY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

More dumb questions.  I am unable to plot anything to my potter in
gnuplot.  I
set the terminal for my plotter ['hpgl 6' for my 7574A plotter] and
tried one of the demo programs.  All I got was a list of the plotter
commands on screen.  I even tried the simple "plot sin(x)" as a test
without success. Is there something else I need to do?

Cheers,

4JRY

p.s. I mistakenly used my regular handle JohnY last time and that is taken.

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: Plotting in WinXP

by Hans-Bernhard Bröker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Yells wrote:

> set the terminal for my plotter ['hpgl 6' for my 7574A plotter] and
> tried one of the demo programs.  All I got was a list of the plotter
> commands on screen.

Because you didn't tell gnuplot where else this output should go.  See
"help set output".

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: Plotting in WinXP

by 4JRY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for all your help.  I think have the program pretty well figured
out now.  It took a while to get back to the command line mode after
years of point and click operations with a mouse.

Cheers

4JRY


------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Can gnuplot be used within AutoCAD

by 4JRY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I did find something else that was part of the gnuplot 4.2 download zip
program. In the main directory their are 2 files named 'wgnuplot.mnu'
and 'wgnuplot-ja.mnu'.  These appear to be menu files for AutoCAD LT
where you can run gnuplot from within AutoCAD LT.

I tried loading these files into 'AutoCAD LT for Windows 95' but they
wouldn't load properly.  Do these programs work and has anyone
successfully loaded them into AutoCAD LT?

Inquiring minds would like to know.

Cheers,

4JRY




------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: Can gnuplot be used within AutoCAD

by Hans-Bernhard Bröker-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Yells wrote:

> I did find something else that was part of the gnuplot 4.2 download zip
> program. In the main directory their are 2 files named 'wgnuplot.mnu'
> and 'wgnuplot-ja.mnu'.  These appear to be menu files for AutoCAD LT
> where you can run gnuplot from within AutoCAD LT.

That appearance is deceiving.  They're nothing of the sort.

Summing it up: the only relation between CAD and gnuplot is that both
deal with vector graphics.

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: source filename as parameter

by babelproofreader :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CarloG wrote:
My main purpose is to exploit as data source a different file each time I invoke gnuplot from a script.

I would like to provide the source file name as a parameter.
For example:
gnuplot my_gnuplot_file data_source_filename

If it is not possible,
I would like to read from gnuplot the content of a text file where the filename is stored,
e.g., assigning to a variable the output of a cat/awk invocation.
Have your 'gnuplot_script' contain $1 to represent the file to be read e.g.

reset
set title "$1 Prices"
set datafile separator ","
set xdata time
set timefmt "%d/%m/%Y"
set grid
plot "$1" using 1:2:3:4:5 notitle with candlesticks lt 7

and then, for example, on the command line type
call 'gnuplot_script' $Gold
which will insert Gold into the script in place of $1 and hence plot the Gold file.

Re: source filename as parameter

by cstar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Carlo!

A more flexible solution is:

> cd scripts
> ls

plot.gnu  plot.sh

> cat plot.gnu

#FILENAME is the filename
#my paramspace and solution files use : as separator
set datafile separator ":"
set term png size 800, 600
#q vs rms
set output 'FILENAME.q.png'
plot [0:1] [0.05:0.08] "FILENAME" using 2:1 title "q vs rms" with points

> cat plot.sh
#/bin/bash
cat plot.gnu | sed "s#\FILENAME#$1#" > plot.tmp
gnuplot plot.tmp

> ./plot.sh somedir/somedatafile

That should do it : )
Enjoy!

Dr. Ing. Dieter Jurzitza wrote:
Hi Carlo,
you cannot provide the data filename on the commandline because it contains no
information what to do.
However, you can have a set of scripts (or a sequence of scripts or
whatever ...)
you call

gnuplot <myscript1>

where
<myscript1>
is any ascii file containing formatting information and the file you want to
plot from. Say you want to plot the first column of "mydata.dat" vs. the
second column of "mydata.dat" you would create a file, say "mydata.plt" that
contains

*********************
plot "mydata.dat" using 1:2 w l lw 2
*********************

(just for example)

If you are on linux (or unix) you could write

*********************
#!/usr/bin/gnuplot
plot "mydata.dat" using 1:2 w l lw 2
*********************

into mydata.plt, make this file executable (chmod 0755 mydata.plt) and call
it - the only thing you have to make sure is that the path to gnuplot fits
your situation.
Hope this helps,
take care



Dieter Jurzitza


--
-----------------------------------------------------------

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------Am Sonntag, 28.
Dezember 2008 23:24:39 schrieb CarloG:
> My main purpose is to exploit as data source a different file each time I
> invoke gnuplot from a script.
>
> I would like to provide the source file name as a parameter.
*****

------------------------------------------------------------------------------
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-info