i am trying to make my first plot with gnuplot. I'm using the WinXP binary.
Gnuplot crashes every time when i start my script. I thought that it might be because of the too long PLOT-command (due to the forum-message 'Extending "plot" string limit on Win32?'. So i divided the plot into two plots and gnuplot crashes again. Then i used only one data block in the plot command and abbreviated every keyword. Gnuplot crashes again. Maybe tere is a line in my script which causes the crashes.
I hope someone can help me.
My script:
reset
#set encoding iso_8859_15
set key right bottom
set xrange [330:362]
set yrange [2:28]
set y2range [-90:90]
set xtic auto
set ytic auto
set y2tic auto
# Beschriftung der Achsen
set xlabel "Frequenz f [Hz]"
set ylabel "Impedanz Z [Ohm]"
set y2label "Phase Phi [Grad]"
set title "Simulation des Impedanz- und Phasenverlaufs des 340Hz-Senders zwischen 0 und 90 Grad Celsius"
# Position des ersten Graphen
# set size 0.5,0.5
# set origin 0.0,0.0
# Plotten des Betrags und der Phase in einem Diagramm title '0'
plot "Tx340.txt" i 0:0 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "red"
# "Tx340.txt" i 1:1 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "blue",\
# "Tx340.txt" i 2:2 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "violet",\
# "Tx340.txt" i 3:3 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "green",\
# "Tx340.txt" i 4:4 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "black",\
# "Tx340.txt" i 5:5 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "cyan",\
# "Tx340.txt" i 6:6 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "pink",\
# "Tx340.txt" i 7:7 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "plum",\
# "Tx340.txt" i 8:8 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "light-grey",\
# "Tx340.txt" i 9:9 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "navy",\
# "Tx340.txt" i 10:10 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "khaki"
# Position des zweiten Graphen
# set size 0.5,0.5
# set origin 0.0,0.5
plot "Tx340.txt" i 0:0 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "red"
# "Tx340.txt" i 1:1 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "blue",\
# "Tx340.txt" i 2:2 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "violet",\
# "Tx340.txt" i 3:3 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "green",\
# "Tx340.txt" i 4:4 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "black",\
# "Tx340.txt" i 5:5 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "cyan",\
# "Tx340.txt" i 6:6 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "pink",\
# "Tx340.txt" i 7:7 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "plum",\
# "Tx340.txt" i 8:8 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "light-grey",\
# "Tx340.txt" i 9:9 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "navy",\
# "Tx340.txt" i 10:10 u 1:(atan($3/$2) w lines axes x1y2 lt rgb "khaki"
#unset multiplot
#plot "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 0:0 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 1:1 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 2:2 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 3:3 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 4:4 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 5:5 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 6:6 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 7:7 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 8:8 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 9:9 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 10:10 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 0:0 using 1:(atan($3/$2)) with lines axes x1y2
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 1:1 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 2:2 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 3:3 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 4:4 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 5:5 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 6:6 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 7:7 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 8:8 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 9:9 using 1:(atan($3/$2)) with lines axes x1y2,\
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 10:10 using 1:(atan($3/$2) with lines axes x1y2
# Ausgabe in externes File
set output "Tx340.txt.eps"
set terminal postscript eps
#set output "Tx340.txt.png"
#set terminal png
set output "Tx340.txt.emf"
set terminal emf
set output "Tx340.txt.jpg"
set terminal jpeg
show terminal
replot
thanks,
Hans
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Gnuplot crashes every time when i start my script.
You'll have to be a bit more specific. Reduce your script to the absolutely smallest that still triggers the "crash", show us you you "start" it, and tell what "it crashes" actually means.
Without the data file, and trying to find my way through all those commented commands to the ones that aren't, I can only guess what the problem is: you shouldn't be using atan($2/$3). The atan2(x,y) function exists precisely to avoid one type of likely "crash" that would cause.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the prompt answer.
The first time (after i started gnuplot) when i run my script a graph window with my graph pops up (but all my output files have the size of 0 bytes). When i start the script a second time a window pops up and tells me that gnuplot encountered a problem and has to be shut down.
> (but all my output files have the size of 0 bytes).
Of course they do. Two didn't get *anything* output into them (you just switched between terminals, but there's nothing that would actually generate output). The last will _appear_ to have nothing in it because you forgot to tell gnuplot you're finished with this file.
Put a
replot
between every two "set terminal"/"set output" blocks, and a
unset output
set term pop
at the end of your script, and it should begin to do what you wanted it to. It may even stop crashing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i am trying to make my first plot with gnuplot. I'm using the WinXP binary.
Gnuplot crashes every time when i start my script. I thought that it might be because of the too long PLOT-command (due to the forum-message 'Extending "plot" string limit on Win32?'. So i divided the plot into two plots and gnuplot crashes again. Then i used only one data block in the plot command and abbreviated every keyword. Gnuplot crashes again. Maybe tere is a line in my script which causes the crashes.
I hope someone can help me.
My script:
reset
#set encoding iso_8859_15
set key right bottom
set xrange [330:362]
set yrange [2:28]
set y2range [-90:90]
set xtic auto
set ytic auto
set y2tic auto
# Beschriftung der Achsen
set xlabel "Frequenz f [Hz]"
set ylabel "Impedanz Z [Ohm]"
set y2label "Phase Phi [Grad]"
set title "Simulation des Impedanz- und Phasenverlaufs des 340Hz-Senders zwischen 0 und 90 Grad Celsius"
set angles degrees
#set rmargin 10
#set lmargin 10
#set tmargin 4
#set bmargin 4
# Gesamter Plotbereich
#set size 1.0,1.0
#set origin 0.0,0.0
# 2 Plots auf einer Seite
#set multiplot
# Position des ersten Graphen
# set size 0.5,0.5
# set origin 0.0,0.0
# Plotten des Betrags und der Phase in einem Diagramm title '0'
plot "Tx340.txt" i 0:0 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "red"
# "Tx340.txt" i 1:1 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "blue",\ # "Tx340.txt" i 2:2 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "violet",\ # "Tx340.txt" i 3:3 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "green",\ # "Tx340.txt" i 4:4 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "black",\ # "Tx340.txt" i 5:5 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "cyan",\ # "Tx340.txt" i 6:6 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "pink",\ # "Tx340.txt" i 7:7 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "plum",\ # "Tx340.txt" i 8:8 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "light-grey",\ # "Tx340.txt" i 9:9 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "navy",\ # "Tx340.txt" i 10:10 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "khaki"
# Position des zweiten Graphen
# set size 0.5,0.5
# set origin 0.0,0.5
plot "Tx340.txt" i 0:0 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "red"
# "Tx340.txt" i 1:1 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "blue",\ # "Tx340.txt" i 2:2 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "violet",\ # "Tx340.txt" i 3:3 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "green",\ # "Tx340.txt" i 4:4 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "black",\ # "Tx340.txt" i 5:5 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "cyan",\ # "Tx340.txt" i 6:6 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "pink",\ # "Tx340.txt" i 7:7 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "plum",\ # "Tx340.txt" i 8:8 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "light-grey",\ # "Tx340.txt" i 9:9 u 1:(atan($3/$2)) w lines axes x1y2 lt rgb "navy",\ # "Tx340.txt" i 10:10 u 1:(atan($3/$2) w lines axes x1y2 lt rgb "khaki"
#unset multiplot
#plot "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 0:0 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 1:1 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 2:2 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 3:3 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 4:4 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 5:5 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 6:6 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 7:7 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 8:8 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 9:9 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 10:10 using 1:(sqrt($2**2+$3**2)) with lines axes x1y1
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 0:0 using 1:(atan($3/$2)) with lines axes x1y2
# "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 1:1 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 2:2 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 3:3 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 4:4 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 5:5 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 6:6 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 7:7 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 8:8 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 9:9 using 1:(atan($3/$2)) with lines axes x1y2,\ # "Trans_340Hz_gem_Daten _342Hz_Tempabh_edit.txt" index 10:10 using 1:(atan($3/$2) with lines axes x1y2
# Ausgabe in externes File
set output "Tx340.txt.eps"
set terminal postscript eps
#set output "Tx340.txt.png"
#set terminal png
set output "Tx340.txt.emf"
set terminal emf
set output "Tx340.txt.jpg"
set terminal jpeg
show terminal
replot
thanks,
Hans
> Gnuplot crashes every time when i start my script.
You'll have to be a bit more specific. Reduce your script to the absolutely smallest that still triggers the "crash", show us you you "start" it, and tell what "it crashes" actually means.
Without the data file, and trying to find my way through all those commented commands to the ones that aren't, I can only guess what the problem is: you shouldn't be using atan($2/$3). The atan2(x,y) function exists precisely to avoid one type of likely "crash" that would cause.
Thank you for the prompt answer.
The first time (after i started gnuplot) when i run my script a graph window with my graph pops up (but all my output files have the size of 0 bytes). When i start the script a second time a window pops up and tells me that gnuplot encountered a problem and has to be shut down.
My stripped script:
--------------------------------------begin script-----------------------------------------
reset
set key right bottom
set xrange [330:362]
set yrange [2:28]
set y2range [-90:90]
set xtic auto
set ytic auto
set y2tic auto
set xlabel "Frequenz f [Hz]"
set ylabel "Impedanz Z [Ohm]"
set y2label "Phase Phi [Grad]"
set title "Simulation des Impedanz- und Phasenverlaufs des 340Hz-Senders zwischen 0 und 90 Grad Celsius"
set angles degrees
plot "Tx340.txt" i 0:0 u 1:(sqrt($2**2+$3**2)) w lines axes x1y1 lt rgb "red"
set output "Tx340.txt.eps"
set terminal postscript eps
set output "Tx340.txt.emf"
set terminal emf
set output "Tx340.txt.jpg"
set terminal jpeg
show terminal
replot
--------------------------------------end script-----------------------------------------
A part of the data file (the whole file consists of 11 data blocks each 10 000 lines long):
The format:
1. column: frequency
2. column: real part
3. column: imaginary part
--------------------------------------begin file-----------------------------------------
#Freq. V(uges)/I(L1)
#Step Information: Temp=0 (Run: 1/11)
3.30000e+002 3.85009e+000 -1.07628e+001
3.30003e+002 3.85009e+000 -1.07587e+001
3.30006e+002 3.85009e+000 -1.07546e+001
3.30010e+002 3.85009e+000 -1.07506e+001
3.30013e+002 3.85009e+000 -1.07465e+001
3.30016e+002 3.85009e+000 -1.07425e+001
3.30019e+002 3.85009e+000 -1.07384e+001
3.30022e+002 3.85009e+000 -1.07344e+001
3.30026e+002 3.85009e+000 -1.07303e+001
3.30029e+002 3.85009e+000 -1.07263e+001
3.30032e+002 3.85009e+000 -1.07222e+001
3.30035e+002 3.85009e+000 -1.07181e+001
3.30038e+002 3.85009e+000 -1.07141e+001
3.30042e+002 3.85009e+000 -1.07100e+001
3.30045e+002 3.85009e+000 -1.07060e+001
3.30048e+002 3.85009e+000 -1.07019e+001
3.30051e+002 3.85009e+000 -1.06979e+001
3.30054e+002 3.85009e+000 -1.06938e+001
3.30058e+002 3.85009e+000 -1.06898e+001
3.30061e+002 3.85009e+000 -1.06857e+001
3.30064e+002 3.85009e+000 -1.06816e+001
3.30067e+002 3.85009e+000 -1.06776e+001
3.30070e+002 3.85009e+000 -1.06735e+001
3.30074e+002 3.85009e+000 -1.06695e+001
3.30077e+002 3.85009e+000 -1.06654e+001
3.30080e+002 3.85009e+000 -1.06614e+001
.
.
.
--------------------------------------end file-----------------------------------------
> (but all my output files have the size of 0 bytes).
Of course they do. Two didn't get *anything* output into them (you just switched between terminals, but there's nothing that would actually generate output). The last will _appear_ to have nothing in it because you forgot to tell gnuplot you're finished with this file.
Put a
replot
between every two "set terminal"/"set output" blocks, and a
unset output
set term pop
at the end of your script, and it should begin to do what you wanted it to. It may even stop crashing.
Thank you. Seems to be working now.