help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to plot two graphs with a textfile with a textdocument with two


From: Ron.Simonson
Subject: Re: How to plot two graphs with a textfile with a textdocument with two x two columns?
Date: Fri, 14 Mar 2014 15:38:06 -0700
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.6esrpre) Gecko/20120713 Thunderbird/10.0.6

On 03/14/2014 02:42 PM, Conrad Kopernikus wrote:

with some physic experiments with picoscope I get a textfile (.txt) with two
columns. But I have to graphs. My textfile look a littlebit like that:

The columns are larger in reality. But how to plot that? I delete the text
and copy the columns for the first graph in a new text-file and the second
in a new text-file. I load both textfiles use the x1=(:,1) and get a plot
like: plot(x1,y1,x2,y2). That works. But is their a faster way to do that?
Can I just use one and same textfile ... but just say to octave it should
make to graphs instead of connecting them?

Oh, Sorry, I forgot to mention.  You can in fact leave all your data in
one file and plot them.  In that case leave the data in one file and
create the plot command file as:

\begin{conrad2.plt}
szTerm = 1
if(szTerm == 1) set term X11
if(szTerm == 2) set terminal pdf
if(szTerm == 3) set terminal png

set key bottom right
set grid

set pointsize 0.6
set xlabel "Time"
set ylabel "Volts"
set xrange [0:120]
set xtics 10
set mxtics 10
set yrange [5.0:9.0]
set ytics 0.5
set mytics 5
set format x "%0.0s%cs"
set format y "%0.1s%cV"
set title "Conrad's data plot\naddbegin.sed used to fix data files"

if(szTerm == 2) set output "conrad.pdf"
if(szTerm == 3) set output "conrad.png"

plot "file.dat" every :::0::0 using 1:($2/1000) title "Channel A" with linespoin
ts, \
"file.dat" every :::1::1 using 1:($2/1000) title "Channel B" with linespoin
ts

if(szTerm == 1) pause -1
\end{conrad2.plt}

Also note the the extension to the plot command file can be anything.
I use .plt so that I can tell what the file is used for without having
to open it.

Talk to you later.  Ron.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]