How can I label a datapoint on a specific y value with its corresponding x value? Extra difficulty is the x values should be in hours and not date.
I have this data:
data.csv:
2019-01-04-11:02:24,1.468
2019-01-04-12:40:54,1.212
2019-01-04-15:16:22,1.123
2019-01-04-17:04:43,1.067
2019-01-04-18:51:45,0.994
2019-01-04-19:51:21,0.919
2019-01-04-20:46:40,0.8
I plot it with:
set datafile separator ","
set terminal png size 600,300 enhanced font 'Verdana,10' linewidth 1
set output 'data.png'
set xdata time
MyTimeFormat = "%Y-%m-%d-%H:%M:%S"
set timefmt MyTimeFormat
set format x "%tH"
set xlabel "hours"
set ylabel "Volt"
set grid ytics xtics mxtics
StartTime = strptime(MyTimeFormat,"2019-01-04-11:01:31")
EndTime = strptime(MyTimeFormat,"2019-01-04-20:47:17")
plot 'data.csv' u (timecolumn(1)-StartTime):2 w lines lw 1 notitle,\
'' u (timecolumn(1)-StartTime):2:1 w labels notitle
That gives this plot:
Lets assume I am interested in displaying a single y value 0.89. How can I label the intersection on the plot with the corresponding x value in hours, like in this plot:
I know the problem is that point does not exist in my data but is this possible anyway? If not, how to do it with an existing y value near the desired value for example this value:
2019-01-04-19:51:21,0.919
Check the following. The ternary operator helps you here.
The label of the first value which is below a certain threshold is plotted as label.
Of course, it would be nicer interpolate the value at the threshold, which also can be done but requires some more coding.
### threshold value as label
reset session
$Data <<EOD
2019-01-04-11:02:24,1.468
2019-01-04-12:40:54,1.212
2019-01-04-15:16:22,1.123
2019-01-04-17:04:43,1.067
2019-01-04-18:51:45,0.994
2019-01-04-19:51:21,0.919
2019-01-04-20:46:40,0.8
EOD
set datafile separator ","
#set terminal png size 600,300 enhanced font 'Verdana,10' linewidth 1
#set output 'data.png'
set xdata time
MyTimeFormat = "%Y-%m-%d-%H:%M:%S"
set timefmt MyTimeFormat
set format x "%tH"
set xlabel "hours"
set ylabel "Volt"
set grid ytics xtics mxtics
StartTime = strptime(MyTimeFormat,"2019-01-04-11:01:31")
EndTime = strptime(MyTimeFormat,"2019-01-04-20:47:17")
set multiplot layout 2,1
OffsetY = 0.1
plot $Data u (timecolumn(1)-StartTime):2 w lp lt 7 lc rgb "red" notitle,\
'' u (timecolumn(1)-StartTime):($2+OffsetY):(sprintf("%.2f",(timecolumn(1)-StartTime)/3600)) w labels notitle
Threshold = 1.1
a = NaN
Flag = 1
plot $Data u (timecolumn(1)-StartTime):2 w lp lt 7 lc rgb "blue" notitle,\
'' u (a = timecolumn(1)-StartTime):\
($2+OffsetY):\
(($2<Threshold) & (Flag==1) ? (Flag=0, sprintf("%.2f|%g",a/3600,Threshold)) : "") w labels notitle
unset multiplot
### end of code
Which results in:
Addition:
Another improved bit more complex solution finds the point of interest (POI) in a first pass, interpolates and finally adds lines and labels.
### threshold value as label
reset session
$Data <<EOD
2019-01-04-11:02:24,1.468
2019-01-04-12:40:54,1.212
2019-01-04-15:16:22,1.123
2019-01-04-17:04:43,1.067
2019-01-04-18:51:45,0.994
2019-01-04-19:51:21,0.919
2019-01-04-20:46:40,0.8
EOD
set datafile separator ","
# set terminal png size 600,300 enhanced font 'Verdana,10' linewidth 1
# set output 'data.png'
set xdata time
MyTimeFormat = "%Y-%m-%d-%H:%M:%S"
set timefmt MyTimeFormat
set format x "%tH:%tM"
set xlabel "hours"
set ylabel "Volt"
set grid ytics xtics mxtics
# settings
Threshold = 0.89
LabelOffsetY = 0.1
Flag = 0
LastX = LastY = TempX = TempY = POIx = NaN
# formula for interpolation and finding the threshold x value
Interpolate(x0,y0,x1,y1,xi) = y0 + (y1-y0)/(x1-x0)*(xi-x0)
ThresholdX(X,Y) = ((LastY>=Threshold) & (Y<Threshold) & (Flag==0)) ? \
(Flag=1, POIx = Interpolate(LastY,LastX,Y,X,Threshold)) : NaN
set table $Dummy
plot $Data u ($0 == 0 ? (StartTime = timecolumn(1), 0) : LastX = TempX, TempX = timecolumn(1)-StartTime, LastY = TempY, TempY = $2, ThresholdX(TempX,TempY)):\
(TempY) w table
unset table
# lines and label
set arrow 1 from graph 0, first Threshold to POIx,Threshold lc rgb "red" nohead
set arrow 2 from POIx,graph 0 to POIx,Threshold lc rgb "red" nohead
set arrow 3 from POIx,Threshold+LabelOffsetY*0.8 to POIx,Threshold lc rgb "black" lw 1.5
set style textbox opaque
set label 1 at POIx,Threshold+LabelOffsetY sprintf("%.2f/%.2f", POIx/3600, Threshold) boxed front
# plotting data
plot $Data u (timecolumn(1)-StartTime):2 w lp lt 7 lc rgb "blue" notitle
### end of code
Related
Below is the script used to generate the plot. What should I change to fix the spacing of the xtic text? I have macOS Catalina.#theozh
#/Users/CourtneyBrea/Desktop/ORR-Figures/free-energy-diagram
myFileIn(i) = sprintf("step-%d.dat",i)
myFileOut(i) = sprintf("step-%d.svg",i)
set term svg font "{/:Bold}Sans,22"
set border 15 front lt black linewidth 3.000 dashtype solid
set xlabel "Reaction Coordinate"
set xrange [-0.2:5.2]
set xtics nomirror scale 0
set ylabel "Free Energy (eV)"
set yrange[-5:0.1]
set ytics out nomirror
set key noautotitle samplen 2
set errorbars 0
dx = 0.2
do for [i=1:30] {
set output myFileOut(i)
plot myFileIn(i) u 0:2:(dx):xtic(1) w xerr lc "blue" lw 3 ps 0 ti columnheader(2), \
'' u 0:3:(dx) w xerr lc "red" lw 3 ps 0 ti columnheader(3), \
x1=y1=NaN '' u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$2,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "blue" nohead, \
x1=y1=NaN '' u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$3,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "red" nohead
}
set output # close the last file
### end of script
Input file below
"Reaction Coordinate" "0 V" "0.43 V"
O_{2} 0 -3.00
O#^*_{2} -0.10 -3.67
OOH^* -1.00 -3.90
O^* -2.00 -4.00
OH^* -4.00 -4.92
H_{2}O -4.92 -4.92
I suspect the problem is that you have placed the enhanced text notation for bold text in the font name rather than placing it in the text being printed. That probably confuses the program you are using to view the resulting svg file.
The correct way is to set the terminal font as just a name and a size, and then separately add any additional markup to the text strings. Revised commands below, with a screen capture of the svg file as viewed in firefox.
Note that I have applied the bold attribute only to the tic labels, because that is the tricky part. You can apply to other labels or text as you like.
set term svg font "Sans,22"
set output "gap.svg"
makebold(text) = sprintf("{/:Bold %s}", text)
set border 15 front lt black linewidth 3.000 dashtype solid
set xlabel "Reaction Coordinate"
set xrange [-0.2:5.2]
set xtics nomirror scale 0
set ylabel "Free Energy (eV)"
set yrange[-5:0.1]
set ytics out nomirror
set key noautotitle samplen 2
set errorbars 0
dx = 0.2
plot "gap.dat" u 0:2:(dx):xtic(makebold(strcol(1))) w xerr lc "blue" lw 3 ps 0 ti columnheader(2), \
'' u 0:3:(dx) w xerr lc "red" lw 3 ps 0 ti columnheader(3), \
x1=y1=NaN '' u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$2,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "blue" nohead, \
x1=y1=NaN '' u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$3,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "red" nohead
Here's the image of my data file:
EPAM_2000_160.txt
When I run it through the cmd prompt, it gives an error: "Cannot find or open file "EPAM_2000_160.txt", No data in plot".
Both these files are present in the same folder in documents. I can't understand why is it unable to find.
Here's the code of the .plt file:
#set terminal x11
#set output
unset clip points
set clip one
unset clip two
set bar 1.000000
set border 31 lt -1 lw 1.000
set xdata time
set ydata time
set zdata time
set x2data time
set y2data time
set cbdata time
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set timefmt "%d/%m/%y,%H:%M"
set boxwidth
set style fill empty border
set dummy x,y
set format x "% g"
set format y "% g"
set format x2 "% g"
set format y2 "% g"
set format z "% g"
set format cb "% g"
set angles radians
unset grid
set key title ""
set key right top Right noreverse enhanced box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 height 0 autotitles
unset label
unset arrow
unset style line
unset style arrow
unset logscale
set offsets 0, 0, 0, 0
set pointsize 1
set encoding default
unset polar
unset parametric
unset decimalsign
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set clabel '%8.3g'
set mapping cartesian
set datafile separator whitespace
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
set xzeroaxis lt -2 lw 1.000
set yzeroaxis lt -2 lw 1.000
set x2zeroaxis lt -2 lw 1.000
set y2zeroaxis lt -2 lw 1.000
set tics in
set ticslevel 0.5
set tics scale 1
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set xtics border mirror norotate autofreq
set ytics border mirror norotate autofreq
set ztics border nomirror norotate autofreq
set nox2tics
set noy2tics
set cbtics border mirror norotate autofreq
set title "" offset 0.000000,0.000000 font ""
set timestamp "" bottom norotate offset 0.000000,0.000000 font ""
set rrange [ * : * ] noreverse nowriteback # (currently [0.00000:10.0000] )
set trange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] )
set urange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] )
set vrange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] )
set xlabel "DOY 2000" offset 0.000000,0.000000 font ""
set x2label "" offset 0.000000,0.000000 font ""
set xrange [ 160.3 : 160.44 ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set x2range [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set ylabel "Ion intensity Sector Avg,1/(cm**2-s-sr-MeV) LEMS120" offset 0.000000,0.000000 font ""
set y2label "" offset 0.000000,0.000000 font ""
set yrange [ 1. : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set y2range [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set zlabel "" offset 0.000000,0.000000 font ""
set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set cblabel "" offset 0.000000,0.000000 font ""
set cbrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
set zero 1e-08
set lmargin -1
set bmargin -1
set rmargin -1
set tmargin -1
set locale "C"
set pm3d scansautomatic flush begin noftriangles nohidden3d implicit corners2color mean
unset pm3d
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin 0.9,0.2 size 0.1,0.63 bdefault
set loadpath
set fontpath
set fit noerrorvariables
set arrow from 160.36,1. to 160.36,700000 nohead
plot 'EPAM_2000_160.txt' u 1:2 t '0.047-0.068 MeV'
set term post colour eps enh
set output "EPAM_2000_160.eps"
replot
set output
set term x11
# EOF
If you open the file with an absolute link, make sure to double each backslash as backslash needs escaping in C/C++ strings.
Otherwise make sure the relative path to the file is correct for the current path from where the application is started.
Thank you so much! Though I believe something is wrong with the .plt file itself. Because I was able to plot just the text file without going through the .plt file. And I have saved that as a new .plt file. So i'll just add the old commands one by one and figure out what messed up ig.
Here is the code for the new .plt file:
# set terminal windows 0 color solid butt enhanced standalone
# set output
unset clip points
set clip one
unset clip two
set errorbars front 1.000000
set border 31 front lt black linewidth 1.000 dashtype solid
set zdata
set ydata
set xdata
set y2data
set x2data
set boxwidth
set style fill empty border
set style rectangle back fc bgnd fillstyle solid 1.00 border lt -1
set style circle radius graph 0.02
set style ellipse size graph 0.05, 0.03 angle 0 units xy
set dummy x, y
set format x "% h"
set format y "% h"
set format x2 "% h"
set format y2 "% h"
set format z "% h"
set format cb "% h"
set format r "% h"
set ttics format "% h"
set timefmt "%d/%m/%y,%H:%M"
set angles radians
set tics back
unset grid
unset raxis
set theta counterclockwise right
set style parallel front lt black linewidth 2.000 dashtype solid
set key title "" center
set key fixed right top vertical Right noreverse enhanced autotitle nobox
set key noinvert samplen 4 spacing 1 width 0 height 0
set key maxcolumns 0 maxrows 0
set key noopaque
unset label
unset arrow
set style increment default
unset style line
unset style arrow
set style histogram clustered gap 2 title textcolor lt -1
unset object
set style textbox transparent margins 1.0, 1.0 border lt -1 linewidth 1.0
set offsets 0, 0, 0, 0
set pointsize 1
set pointintervalbox 1
set encoding cp1252
unset polar
unset parametric
unset decimalsign
unset micro
unset minussign
set view 60, 30, 1, 1
set view azimuth 0
set rgbmax 255
set samples 100, 100
set isosamples 10, 10
set surface
unset contour
set cntrlabel format '%8.3g' font '' start 5 interval 20
set mapping cartesian
set datafile separator whitespace
unset hidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels 5
set cntrparam levels auto
set cntrparam firstlinetype 0 unsorted
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
set style data points
set style function lines
unset xzeroaxis
unset yzeroaxis
unset zzeroaxis
unset x2zeroaxis
unset y2zeroaxis
set xyplane relative 0.5
set tics scale 1, 0.5, 1, 1, 1
set mxtics default
set mytics default
set mztics default
set mx2tics default
set my2tics default
set mcbtics default
set mrtics default
set nomttics
set xtics border in scale 1,0.5 mirror norotate autojustify
set xtics norangelimit autofreq
set ytics border in scale 1,0.5 mirror norotate autojustify
set ytics norangelimit autofreq
set ztics border in scale 1,0.5 nomirror norotate autojustify
set ztics norangelimit autofreq
unset x2tics
unset y2tics
set cbtics border in scale 1,0.5 mirror norotate autojustify
set cbtics norangelimit autofreq
set rtics axis in scale 1,0.5 nomirror norotate autojustify
set rtics norangelimit autofreq
unset ttics
set title ""
set title font "" textcolor lt -1 norotate
set timestamp bottom
set timestamp ""
set timestamp font "" textcolor lt -1 norotate
set trange [ * : * ] noreverse nowriteback
set urange [ * : * ] noreverse nowriteback
set vrange [ * : * ] noreverse nowriteback
set xlabel ""
set xlabel font "" textcolor lt -1 norotate
set x2label ""
set x2label font "" textcolor lt -1 norotate
set xrange [ * : * ] noreverse writeback
set x2range [ * : * ] noreverse writeback
set ylabel ""
set ylabel font "" textcolor lt -1 rotate
set y2label ""
set y2label font "" textcolor lt -1 rotate
set yrange [ * : * ] noreverse writeback
set y2range [ * : * ] noreverse writeback
set zlabel ""
set zlabel font "" textcolor lt -1 norotate
set zrange [ * : * ] noreverse writeback
set cblabel ""
set cblabel font "" textcolor lt -1 rotate
set cbrange [ * : * ] noreverse writeback
set rlabel ""
set rlabel font "" textcolor lt -1 norotate
set rrange [ * : * ] noreverse writeback
unset logscale
unset jitter
set zero 1e-08
set lmargin -1
set bmargin -1
set rmargin -1
set tmargin -1
set locale "English_India.1252"
set pm3d explicit at s
set pm3d scansautomatic
set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean
set pm3d nolighting
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
set palette rgbformulae 7, 5, 15
set colorbox default
set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault
set style boxplot candles range 1.50 outliers pt 7 separation 1 labels auto unsorted
set loadpath
set fontpath
set psdir
set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5
GNUTERM = "windows"
## Last datafile plotted: "EPAM_2000_160_CUT.txt"
plot "EPAM_2000_160_CUT.txt" u 1:2 t '0.047-0.068 MeV' , "EPAM_2000_160_CUT.txt" u 1:3 t'0.068-0.115 MeV' , "EPAM_2000_160_CUT.txt" u 1:4 t'0.115-0.195 MeV' , "EPAM_2000_160_CUT.txt" u 1:5 t'0.195-0.321 MeV'
# EOF
I have in file='Circle.dat' the following 5 columns which correspond to t,x,y,v_x,v_y
0.00000000 1.50000000 1.00000000 -0.00000000 0.500000000
9.99999978E-03 1.49997497 1.00499988 -4.99991653E-03 0.499974996
1.99999996E-02 1.49989998 1.00999928 -9.99933295E-03 0.499900013
2.99999993E-02 1.49977505 1.01499772 -1.49977496E-02 0.499775022
...
How can use gnuplot to make 2D animation based on the followings
gnuplot> file = ”Circle.dat”
gnuplot> set xrange [0:1.6]; set yrange [0:1.6]
gnuplot> t0 = 0; tf = 20 ; dt = 0.1
gnuplot> load ”animate2D.gnu”
I'm doing a multiplot on gnuplot 5.0 and I set my own labels for the y axis, but it seems that some of these labels are plotted more than once, since they have a bold outlook.
Here is what it looks like:
Here is my code:
set multiplot layout 3,2 rowsfirst title 'Time stuff'
TOPGRAPH = "set tmargin at screen 0.80;set bmargin at screen 0.60;set ytics(0,14,18,22);set yrange[12:22];unset ylabel"
MIDDLEGRAPH = "set tmargin at screen 0.60;set bmargin at screen 0.40;set ytics(0,2,5,8);set yrange[0:10];unset ylabel"
BOTTOMGRAPH = "set tmargin at screen 0.40;set bmargin at screen 0.20;set ytics(0,6,7);set yrange[5:8];unset ylabel"
LRMARGIN = "set lmargin at screen 0.15;set rmargin at screen 0.45"
NOXLABEL = "unset xlabel"
XTICS = "set xtics 0,2500,10000; set format ''"
#TOPGRAPH;#LRMARGIN;#NOXLABEL;#XTICS
set label 1 'X length' at screen 0.10, 0.65 rotate left
plot 'ite_x' u 1:3:4 w filledcu lc 'grey' notitle, 'ite_x' u 1:2 w lines lc 'red' notitle
#MIDDLEGRAPH;#LRMARGIN;#NOXLABEL;#XTICS
set label 2 'Y length' at screen 0.10,0.45 rotate left
plot 'ite_y' u 1:3:4 w filledcu lc 'grey' notitle, 'ite_y' u 1:2 w lines lc 'red' notitle
#BOTTOMGRAPH;#LRMARGIN
set arrow from 0,5 to 0,8 nohead front
set label 3 'Z length' at screen 0.10,0.25 rotate left
unset format x
set xtics 0,2500,10000
set xlabel 'Time when bead placed'
plot 'ite_z' u 1:3:4 w filledcu lc 'grey' notitle, 'ite_z' u 1:2 w lines lc 'red' notitle
Hello I tried to make a projectile motion using GNUPlot.
This is the way I made the script, first I define a function of y (initial velocity in y is zero, initial velocity in x is 1, initial vertical position is at yinit =34, initial horizontal position is at zero (origin))
(sorry for the ineffective way of making it, I am quite new here)
set term post eps color enhanced font "Times, 24"
set size 1.2, 0.8
set bmargin 3.5
set xlabel "{/Italic x} (m)" font "Times, 30"
set xtics 0 0.5 font "Times, 28"
set mxtics 4
set xrange[0:2.5]
set ylabel "{/Italic y} (m)" font "Times, 30"
set ytics 5 font "Times, 28"
set mytics 2
set yrange [0:40]
set grid xtics ytics mxtics mytics
yinit = 34
vxinit = 1
gr = -9.8
y(t) = yinit + 0.5*gr*t*t
x(t) = vxinit*t
t = 0.0
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.1
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.2
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.3
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.4
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.5
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.6
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.7
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.8
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 0.9
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
t = 1.0
timestamp = sprintf("{/Italics t} = %1.2f Sekon", t);
filename = sprintf("projectile-%1.1f.eps", t);
set output filename
unset label
set label timestamp at -0.25, -0.28 font ", 28"
plot y(t) w p pt 5 ps 2.5 t ""
plot x(t) w p pt 5 ps 2.5 t ""
(still cannot post image here, still have a low reputation)
And about the colour, i want to make blue
You need a parametric plot: plot the (x,y)-position at different steps of an independent variable:
yinit = 34
vxinit = 1
gr = -9.8
y(t) = yinit + 0.5*gr*t*t
x(t) = vxinit*t
set parametric
set trange [0:1]
set samples 11
plot x(t), y(t) with linespoints pt 7 lc rgb 'blue'