gnuplot changed 5.2->5.4 does not mirror ytics to y2tics - gnuplot

I always (until v5.2) had the tics on y axis mirrored on y2 axis. Since the 5.4 update this does not happen. I did not find an option to enable this.
How do I request to mirror y tics on the y2 axis?
I am on fedora 36 which has "gnuplot 5.4 patchlevel 3".
TIA
[later, asked to add a sample script]
set term postscript eps enhanced color "Helvetica" 22 size 19,10
set timefmt "%Y%m%d%H%M%S"
set autoscale xy
set style data lp
set xdata time
set xtics 3600
set grid xtics
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"white" behind
set key right bottom # legend location
set output "ups_w.ps"
set ylabel "UPS Load (W)"
set ytics 10
set yrange [0:100]
set grid ytics
plot "ups_load" using 1:2 title 'UPS load W' w l lw 5
exit
The end (as an example) of ups_load is
20220709173701 30
20220709173801 28
20220709173901 26
20220709174001 28
20220709174101 28
20220709174201 26
20220709174301 27
20220709174401 28
20220709174501 28
20220709174601 28
20220709174701 28
20220709174801 28
20220709174901 28
Adding set ytics mirror had no effect.
AFAIK I made no change to the script yet the output changed after gnuscript v5.4 (as part of fedora 36 upgrade) was installed.
HTH
[even later] I now restored my script from earlier than the gnuplot update and there are no tic number showing on the y2 axis (using v5.4).
So, same old script that with 5.2 did mirror to y2, does not with 5.4.
FYI I have the old plots (emailed to me daily) and they changed on the day gnuplot was updated.

Thanks #Ethan.
Adding set link y2 by itself did not add to the y2.
Adding
set ytics nomirror
set y2tics nomirror
set link y2
shows y2tics but at a default settings and I had to add more:
set ytics nomirror
set y2tics nomirror
set link y2
set y2tics 10
and now it works.
Actually using only this:
set link y2
set y2tics 10
did the trick too.
Is there a way to say "use all ytics settings for y2tics"? My "real" script has recipes for about 100 plots and now I will have to update most.
Now my question remains: What changed between 5.2 and 5.4 to require these additions? I did not find any settings/configs that changed.
As I explained, I recovered the script as it was before the software update.
I have a full system backup done just before the software upgrade.
Using the old script with 5.4 today has no y2tics showing.
My records show that this old script produced plots with tics using 5.2, then changed from the day following the software update to show none.
BTW show loadpath says:
loadpath is empty
gnuplotrc is read from /usr/share/gnuplot/5.4
no XAPPLRESDIR found in the environment,
falling back to "#X11_APPDEFAULTS_DIR#"
Comparing /usr/share/gnuplot/5.2 to .../5.4/ the only non-comment changes I see are in gnuplot.gih which looks like a help file and in:
js/gnuplot_mouse.js
js/gnuplot_svg.js
Anything else I should check?

First, I am now using a different plot (temp_all) because the original I reported (ups_w) is not part of the daily emails.
This is the script as used during the period of these (see beblow) two images. It is generated by a much larger cgi-bin script, which includes this stanza:
debdir='/data/logs/gnuscript'
cat "$GNUPLOTSCRIPT" >/data/logs/gnuscript/gnu-temp_all.script
gnuplot <"$GNUPLOTSCRIPT"
You will notice that this one does include a reference to y2:
set y2tics 2
Also, v5.4 did not like
set notime
which I later commented out. I do not even remember why it is there...
gnu-temp_all.script
===================
set term postscript eps enhanced color "Helvetica" 22 size 19,10
set timefmt "%Y%m%d%H%M%S"
set notime
set autoscale xy
set ytics 2
#set size 2,2
set style data lp
set xlabel "2022-07-11 10:40:32, src=temp\\_all?from=36h?x=1h, since=20220709220117"
set xdata time
set xtics 3600
set grid xtics
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"white" behind
set key right bottom # legend location
set output "temp_all.ps"
# common temperature limit
otemp=0
ntemp(temp) = ((itemp=0+temp), (itemp >= 85 ? otemp : (otemp=itemp, itemp)))
# default value if zero
dval(v,d) = (0 == 0+v ? 0+d : 0+v)
set ylabel "Temperature (dC)"
set grid ytics
set y2tics 2
set key left top # legend location
plot "temp_bed_floor" using 1:2 title 'bedroom floor (10:38:14 8.75)' w l lw 5 lc rgb "#40A040", "temp_bed_bed" using 1:2 title 'bedroom bed (8.625)' w l lw 5 lc rgb "black", "temp_bed_top" using 1:2 title 'bedroom top (10.875)' w l lw 5 lc rgb "#80F080", "temp_bed_heater" using 1:2 title 'bedroom carpet (8.9375)' w l lw 5 lc rgb "#C0FF60", "temp_bed_door_in" using 1:2 title 'bedroom door (8.875)' w l lw 5 lc rgb "#4040A0", "temp_bed_door_out" using 1:2 title 'bedroom bathroom (11.5625)' w l lw 5 lc rgb "#8080C0", "temp_bed_bme" using 1:2 title 'bedroom bme (10.84)' w l lw 5 lc rgb "brown", "temp_wardrobe" using 1:2 title 'wardrobe (10:37:13 8.5625)' w l lw 5 lc rgb "gray", "temp_north_roof" using 1:2 title 'north roof (10:37:13 6.4375)' w l lw 5 lc rgb "#00E0F0", "temp_panels" using 1:2 title 'PV panels (10:37:13 18.5)' w l lw 5 lc rgb "orange", "temp_living" using 1:2 title 'living room (10:38:13 7.125)' w l lw 5 lc rgb "#FF7070", "temp_raked" using 1:2 title 'living ceiling (10:38:15 8)' w l lw 5 lc rgb "#E0A0A0", "temp_dining" using 1:2 title 'dining room (10:38:47 7.8125)' w l lw 5 lc rgb "magenta", "temp_kitchen" using 1:2 title 'kitchen (10:39:00 8.1875)' w l lw 5 lc rgb "#406080", "temp_moist" using 1:2 title 'moist esp-32c )' w l lw 5 lc rgb "#a0a0ff", "temp_fridge" using 1:2 title 'fridge (10:38:53 8.0625)' w l lw 5 lc rgb "#0080C0", "temp_music" using 1:2 title 'music room (10:38:38 9.1875)' w l lw 5 lc rgb "#00FFFF", "temp_roof" using 1:2 title 'south roof (10:38:07 7.625)' w l lw 5 lc rgb "#0000FF", "temp_weather" using 1:2 title 'weather (10:38:26 7.1)' w l lw 5 lc rgb "#C08080", "temp_work_window" using 1:2 title 'workroom window (10:38:38 7.25)' w l lw 5 lc rgb "dark-violet", "temp_work_room" using 1:2 title 'workroom desk (10:40:01 16.4)' w l lw 5 lc rgb "#4040FF", "temp_work_roof" using 1:2 title 'workroom roof (10:40:01 6.8)' w l lw 5 lc rgb "#8080E0", "bom" using 1:2 title 'BOM (09:30:00 4.7)' w l lw 5 lc rgb "red"
exit
The following images are from the daily email on the day before the upgrade and then the following day, showing the difference. The plots are generated at 5pm so they nicely bracket the upgrade time.
plot from 2022/06/09 (before the upgrade)
This is the relevant log of the upgrade:
2022-06-09T18:04:52+1000 DEBUG Upgraded: gnuplot-common-5.4.3-3.fc36.x86_64
2022-06-09T18:04:52+1000 DEBUG Upgraded: gnuplot-latex-5.4.3-3.fc36.noarch
2022-06-09T18:04:52+1000 DEBUG Upgraded: gnuplot-wx-5.4.3-3.fc36.x86_64
2022-06-09T18:04:52+1000 DEBUG Upgraded: gnustep-base-libs-1.28.0-5.fc36.x86_64
It is possible that the upgrade installed other settings/configs that I am not aware of, let me know what to look for.
plot from 2022/06/10 (after the upgrade)

I think you may be using the word "mirror" to mean something different than what gnuplot uses it to mean. The command set ytics mirror tells gnuplot to draw identical tic marks along both the left and the right edges of the plot's bounding rectangle. It does not do anything at all to y2 axis tics or labels. The vertical position of these tics is controlled by the y axis range and tic intervals.
I am guessing that what you are asking is how to enable the y2 axis tics and y2 tic labels, and draw tic marks and labels for both y and y2. In this case you should disable mirroring for both y and y2 so that the y axis commands will affect only what is drawn on the left border and the y2 axis commands will affect only what is drawn on the right border.
set ytics nomirror
set y2tics nomirror
These commands by themselves leave y and y2 with independent range and scale, which is useful if you are superimposing plots from two data sets with unrelated y values, e.g.
plot 'temperature' axes x1y1, 'rainfall' axes x1y2
In this case the y axis might run from 10 to 50 in °C, while the y2 axis might run from 0 to 5 in centimeters.
If you want to force y and y2 to have identical range and scale, you can use the command
set link y2
The general form of the set link command handles cases where the y and y2 axes are related but not identical (e.g. °F on y1 and °C on y2).
set link y2 via (y-32)*5./9. inverse (y*9./5.)+32
**Amended answer here in response to revised question. **
Taking it from the top.
Commands of the form set noFOO were deprecated in gnuplot 5 in favor of unset FOO. Both versions 5.2 and 5.4 will accept this form but warn that it is deprecated. The actual command is unset timestamp. Version 5.2 accepted the incomplete form unset time but version 5.4 requires more letters to disambiguate unset timestamp from unset timefmt.
The script you show says both set ytics 2 and set y2tics 2. But this cannot be the script used to generate the attached output because the attached output show tic intervals of 0.02 instead
I replaced both those commands with set ytics 0.02
I added the single command set link y2
I generated some dummy data just for the purpose of generating a test plot (not time data so I turned off the x-axis time labels).
Both versions 5.2 and 5.4 default to key placement at the top of plot. The output you show has it at the bottom, so again that is an indication that the script shown is not the same as originally used. I added a command set key bottom.
I then get the plot below from your script using version 5.4.3
Bottom line:
The only changes needed to switch from version 5.2 to version 5.4 are
Replace set notime with unset timestamp or delete altogether
Add the command set link y2. You could put this in your init file ~/.gnuplot and not have to modify working scripts any further.

Related

Show error bars in a multiaxis plot in Gnuplot

I have a dataset (show-errorbar.dat) containing:
Model# DE IE Error
Apple -4.6 -128.9538 4.0
Huawei -5.2 -176.6343 5.3
One-Pro -5.2 -118.1106 3.2
#!/usr/bin/gnuplot
#set terminal pdfcairo enhanced color font 'Helvetica,12' linewidth 0.8
set terminal png
set output 'BrandError.png'
set boxwidth 1.0 relative
set bmargin 5
set style fill solid border -1
set xtic rotate by -45 scale 0
#set auto x
set style line 81 lt 0 lc rgb "#808080" lw 0.5
set grid xtics
set grid ytics
set grid mxtics
set grid mytics
set grid back ls 81
set arrow from graph 0,first -4.6 to graph 1, first -4.6 nohead lw 2 lc rgb "#000000" front
set border 11
set border lw 2.0
set xtics font ",11"
set ytics font ",14"
set tics out
set ytics nomirror
set y2tics
set y2tics font ",14"
set mxtics 10
set mytics 2
set my2tics 2
set yrange [-10:0]
set y2range [-260:0]
set key left bottom
set y2label offset -2
set ylabel offset 2
set ylabel 'DE' tc rgb "red"
set y2label 'IE' tc rgb "green"
set style data histograms
set style histogram cluster gap 2
set linetype 2 lc rgb 'red'
set linetype 3 lc rgb 'yellow'
set linetype 4 lc rgb 'green'
plot 'show-errorbars.dat' using 2 ti 'DE' lc 2 axis x1y1, '' u 3:xticlabels(1) ti 'IE' lc 4 axis x1y2
set output
enter image description here
I would like to plot a histogram comparing DE vs IE and also show error bars (data in column 4) for the IE values.
Please any help on how to go about it.
There is a variant histogram style for exactly that purpose
set style histogram errorbars gap 2 {lw W}.
Here is the help section from the docs:
The `errorbars` style is very similar to the `clustered` style, except that it
requires additional columns of input for each entry. The first column holds
the height (y value) of that box, exactly as for the `clustered` style.
2 columns: y yerr bar extends from y-yerr to y+err
3 columns: y ymin ymax bar extends from ymin to ymax
The appearance of the error bars is controlled by the current value of
`set errorbars` and by the optional <linewidth> specification.
Updated answer
Notes:
You can't mix axis choice within a single histogram. So I have removed the axes x1y1 and axes x1y2 from the plot command. Since you have explicitly given the range for both y1 and y2, the plot border and labels are not affected.
However since the green bars are now being plotted against y1, we have to scale them so that the y2 axis labels apply. So the column 3 and column 4 values will be divided by 26, which is (y2 range) / (y1 range)
In "histogram errorbars" mode each plot component looks for an extra column of data to determine the size of the errorbar. Since your column 2 data has no corresponding column of errors, we dummy it up to use all a constant not-a-number (no data) value: (NaN)
Your data contains a line of columnheaders, which could confuse the program if it thinks this is a line of data. There are a number of ways you can tell the program to skip this line; I have used set key autotitle columnhead for convenience and because it is supported by old versions of gnuplot. If you have a current version it would be better to use instead set datafile columnheaders.
I have kept all of your commands except that the plot command is replaced by the following 3 lines:
set style histogram errorbars gap 2 lw 1.5
set key autotitle columnhead
plot 'show-errorbars.dat' using 2:(NaN) ti 'DE' lc 2, '' u ($3/26.):($4/26.):xticlabels(1) ti 'IE' lc 4

Bubble graphs - how to use?

Is it possible to combinate "normal points" and "bubble points"? I have two sets of data - file1.txt and file2.txt and for one of them (file2.txt) I would like to use points like http://gnuplot-tricks.blogspot.com/2009/06/
How to compose this into code please? When I use the code from that webpage how to plot another data. I tried this:
f(x) = A*exp(-x*x/B/B)
rx=0.107071; ry=0.057876; A = 1; B = 0.2; C=0.5*rx; D=-0.4*ry
g(u,v) = (2*cos(u)*v*rx+C)*(2*cos(u)*v*rx+C)+(3.5*sin(u)*v*ry+D)*(3.5*sin(u)*v*ry+D)
unset key; unset colorbox; set view map
set xrange [-0.15:5.2]; set yrange [-0.7:0.95]
set parametric; set urange [0:2*pi]; set vrange [0:1]
set isosamples 20, 20; set samples 30
set palette model HSV functions 1, 1-f(gray), 1+2*f(gray)
splot cos(u)*rx*v-0.13335347,sin(u)*ry*v+2.7730389, g(u,v) w pm3d, \
cos(u)*rx*v-0.11625481,sin(u)*ry*v+3.5312312, g(u,v) w pm3d, \
cos(u)*rx*v-0.14454222,sin(u)*ry*v+3.6412394, g(u,v) w pm3d, \
cos(u)*rx*v-0.070272446,sin(u)*ry*v+3.8070912, g(u,v) w pm3d, \
cos(u)*rx*v-0.10077238,sin(u)*ry*v+4.090774, g(u,v) w pm3d, \
'file1.txt' using 2:1:(0.0):2 with points pt 7 ps 1 palette
but file2 is not splot. Thank you very much
Here is a variant of the "trick" shown in your second link. I have extracted the customized point styles into a pre-defined set of linetypes. This makes the plot command itself simpler, and it is easier to reuse the definitions in multiple plots.
set linetype 101 ps 3.0 pt 7 lc rgb "#ff0000"
set linetype 102 ps 2.6 pt 7 lc rgb "#ff2222"
set linetype 103 ps 2.2 pt 7 lc rgb "#ff4444"
set linetype 104 ps 1.8 pt 7 lc rgb "#ff6666"
set linetype 105 ps 1.4 pt 7 lc rgb "#ff8888"
set linetype 106 ps 1.0 pt 7 lc rgb "#ffaaaa"
set linetype 107 ps 0.6 pt 7 lc rgb "#ffcccc"
set linetype 108 ps 0.2 pt 7 lc rgb "#ffeeee"
set border back
plot for [LT=101:108] 'silver.dat' using 1:2 with point lt LT notitle
Please clarify what exactly what properties your plot needs to have.
(1) The term "bubble plot" usually refers to a plot in which each point is drawn as a circle with additional properties encoded by changing the size, color, or other property of the circle. Gnuplot can do that quite well. A good example can be found in the online demo collection: Hypertext bubble chart In this case the size of the circle is used to indicate relative population and additional information is encoded as hypertext (pop-up text box) attached to that point. Variable color could easily be added as well. The png version below does not include the hypertext.
(2) The example you link in the query does not appear to encode any additional information into the shape or color of the point but it does use a fancy glyph for each point rather than a simple dot or cross. Gnuplot can do that also. It depends on exactly what set of symbols or glyphs you want to use. If you can find a font providing appropriate glyphs then one way is shown here:
shape(i) = (i%4 == 0) ? "⊕" : (i%4 == 1) ? "⊙" : (i%4 == 2) ? "⊚" : "⦾"
set grid x y z vertical
splot 'silver.dat' using 1:2:3:(shape(int(column(0))) with labels textcolor "forest-green"
More complicated options are also possible but may depend on exactly what you need and what output format (gnuplot "terminal type") is acceptable.

gnuplot curve from file and parametric sphere

I am trying to plot in a 3d space a curve coming from a file and a sphere made with parametric entries.
The idea is to plot the planet Earth and the orbit of a satellite.
The orbit is defined in a file x y z and gnuplot commands are simply
splot 'file.txt' u 1:2:3 title 'Orbit element 1' with lines
Orbit satellite :
I found a script to plot the Earth
#color definitions
set border lw 1.5
set style line 1 lc rgb '#000000' lt 1 lw 2
set style line 2 lc rgb '#c0c0c0' lt 2 lw 1
unset key; unset border
set tics scale 0
set lmargin screen 0
set bmargin screen 0
set rmargin screen 1
set tmargin screen 1
set format ''
set mapping spherical
set angles degrees
set xyplane at -1
set view 56,81
set parametric
set isosamples 25
set urange[0:360]
set vrange[-90:90]
r = 0.99
splot r*cos(v)*cos(u),r*cos(v)*sin(u),r*sin(v) with lines linestyle 2,'world.dat' with lines linestyle 1
unset parametric
Unfortunately, I am not able to mix splot wiht the data file and the splot with the parametric.
Any suggestions more than welcome!
Thanks
In order to generate the plot below, I used the data linked in this blog post. Now, if we want to combine several data sources into one plot, we will need to convert one or the other into a common system of coordinates. If the satellite data is in Cartesian x,y,z coordinates, perhaps the easiest solution would be to convert the world map into Cartesian system as well.
This could be done as shown below. The parameter R denotes the radius of the sphere on the surface of which Gnuplot draws the world map. It should be slightly larger than r so that hidden3d works. The columns in the world_110m.txt file have the meaning of longitude (first column) and latitude (second column), therefore the conversion is given as (R*cos($1)*cos($2)):(R*sin($1)*cos($2)):(R*sin($2)). In the file input.pnts.dat, I just generated coordinates of points on an ellipse with a=1.6 and b=1.2 rotated around the x axis by 45 degrees (counterclockwise). For real satellite data, one would need to rescale the coordinates by dividing by the radius of Earth, i.e., use ($1/Re):($2/Re):($3/Re) instead of 1:2:3, where Re denotes the radius in whichever units your data is (probably meters, judging by the first plot in your question).
set terminal pngcairo
set output 'fig.png'
set xr [-2:2]
set yr [-2:2]
set zr [-2:2]
#color definitions
set border lw 1.5
set style line 1 lc rgb '#000000' lt 1 lw 2
set style line 2 lc rgb '#c0c0c0' lt 2 lw 1
unset key; unset border; set tics scale 0
set format ''
set angles degrees
set xyplane at -1
set view 56,81
set lmargin screen 0
set bmargin screen 0
set rmargin screen 1
set tmargin screen 1
set parametric
set isosamples 25
set urange[0:360]
set vrange[-90:90]
r = 0.99
R = 1.00
set hidden3d
#since we are using Cartesian coordinates, we don't want this
#set mapping spherical
splot \
r*cos(v)*cos(u),r*cos(v)*sin(u),r*sin(v) with lines linestyle 2, \
'world_110m.txt' u (R*cos($1)*cos($2)):(R*sin($1)*cos($2)):(R*sin($2)) w l lw 2 lc rgb 'black', \
'input.pnts.dat' u 1:2:3 w l lw 2 lc rgb 'red'
This then gives:

gnuplot histogram chart with overlap

I would like to plot a bar chart or histogram like this in gnuplot.
I tried set style histogram rowstacked which is a start but it adds the columns on top of each other while I need them overlapped. Next is the issue of transparent color shading.
Thanks for your feedback.
UPDATE: user8153 asked for additional data.
The set style histogram clustered gap 0.0 is doing the cluster mode of the histogram bars. If you blur the eye it sort-of shows what I want but with overlap and transparent shading.
The only other histogram modes given in the docs are rowstacked and columnstacked. I never got a plot out of columnstacked so I discarded it. Now rowstacked stacks the histogram bars.
The overlay appearance is there but it is wrong. I don't want the stacked appearance. The histograms have to overlay.
Code :
set boxwidth 1.0 absolute
set style fill solid 0.5 noborder
set style data histogram
set style histogram clustered gap 0.0
#set style histogram rowstacked gap 0.0
set xtics in rotate by 90 offset first +0.5,0 right
set yrange [0:8000]
set xrange [90:180]
plot 'dat1.raw' using 3 lc rgb 'orange', \
'dat2.raw' using 3 lc rgb 'blue', \
'dat3.raw' using 3 lc rgb 'magenta'
Thanks for your feedback.
Given a sample datafile test.dat
-10 4.5399929762484854e-05
-9 0.0003035391380788668
-8 0.001661557273173934
-7 0.007446583070924338
-6 0.02732372244729256
-5 0.0820849986238988
-4 0.20189651799465538
-3 0.4065696597405991
-2 0.6703200460356393
-1 0.9048374180359595
0 1.0
1 0.9048374180359595
2 0.6703200460356393
3 0.4065696597405991
4 0.20189651799465538
5 0.0820849986238988
6 0.02732372244729256
7 0.007446583070924338
8 0.001661557273173934
9 0.0003035391380788668
10 4.5399929762484854e-05
you can use the following commands
set style fill transparent solid 0.7
plot "test.dat" with boxes, \
"test.dat" u ($1+4):2 with boxes
to get the following result (using the pngcairo terminal):
Using transparency as in user8153's solution is certainly the easiest way to visualize an overlap of two histograms.
This works even if the two histogram do not have identical bins or x-data-ranges.
However, the color of the overlap is pretty much bound to the colors of the two histogram and the level of transparency. Furthermore, if you want to show the overlap in the key you have to do it "manually".
Here is a solution where you can choose an independent color for the overlap area.
The overlap is basically the minimum y-value from both histograms for each x-value.
For this you need to compare the y-values for each x-value. This can be done in gnuplot with some "trick" by merging the two files line by line. This requires the data in a datablock (how to get it there from a file). Since this merging procedure is using indexing of datablock lines, it requires gnuplot>=5.2.0.
This assumes that you have the same x-range and bins for each histogram. If this is not the case, you have to implement some further steps.
Script: (works with gnuplot>=5.2.0, Sept. 2017)
### plot overlap of two histograms
reset session
# create some random test data
set samples 21
f(x,a,b) = 1./(a*(x-b)**4+1)
set table $Data1
plot '+' u 1:(f(x,0.01,-2)) w table
set table $Data2
plot '+' u 1:(f(x,0.02,4)) w table
unset table
set boxwidth 1.0
set grid y
set ytics 0.2
set multiplot layout 2,1
set style fill transparent solid 0.3
plot $Data1 u 1:2 w boxes lc 1 ti "Data1", \
$Data2 u 1:2 w boxes lc 2 ti "Data2"
set print $Overlap
do for [i=1:|$Data1|] { print $Data1[i].$Data2[i] }
set print
set style fill solid 0.3
plot $Data1 u 1:2 w boxes lc 1 ti "Data1", \
$Data2 u 1:2 w boxes lc 2 ti "Data2", \
$Overlap u 1:($2>$4?$4:$2) w boxes lc "red" ti "Overlap"
unset multiplot
### end of script
Result:

Add a single point at an existing plot

I am using the following script to fit a function on a plot. In the output plot I would like to add a single value with etiquette on the fitting curve lets say the point f(3.25). I have read that for gnuplot is very tricky to add one single point on a plot particularly when this plot is a fitting function plot.
Has someone has an idea how to add this single point on the existing plot?
set xlabel "1000/T (K^-^1)" font "Helvetica,20"
#set ylabel "-log(tau_c)" font "Helvetica,20"
set ylabel "-log{/Symbol t}_c (ns)" font "Helvetica,20"
set title "$system $type $method" font "Helvetica,24"
set xtics font "Helvetica Bold, 18"
set ytics font "Helvetica Bold, 18"
#set xrange[0:4]
set border linewidth 3
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
#set key on bottom box lw 3 width 8 height .5 spacing 4 font "Helvetica, 24"
set key box lw 3 width 4 height .5 spacing 4 font "Helvetica, 24"
set yrange[-5:]
set xrange[1.5:8]
f(x)=A+B*x/(1000-C*x)
A=1 ;B=-227 ; C=245
fit f(x) "$plot1" u (1000/\$1):(-log10(\$2)) via A,B,C
plot [1.5:8] f(x) ti "VFT" lw 4, "$plot1" u (1000/\$1):(-log10(\$2)) ti "$system $type" lw 10
#set key on bottom box lw 3 width 8 height .5 spacing 4 font "Helvetica, 24"
set terminal postscript eps color dl 2 lw 1 enhanced # font "Helvetica,20"
set output "KWW.eps"
replot
There are several possiblities to set a point/dot:
1. set object
If you have simple points, like a circle, circle wedge or a square, you can use set object, which must be define before the respective plot command:
set object circle at first -5,5 radius char 0.5 \
fillstyle empty border lc rgb '#aa1100' lw 2
set object circle at graph 0.5,0.9 radius char 1 arc [0:-90] \
fillcolor rgb 'red' fillstyle solid noborder
set object rectangle at screen 0.6, 0.2 size char 1, char 0.6 \
fillcolor rgb 'blue' fillstyle solid border lt 2 lw 2
plot x
To add a label, you need to use set label.
This may be cumbersome, but has the advantage that you can use different line and fill colors, and you can use different coordinate systems (first, graph, screen etc).
The result with 4.6.4 is:
2. Set an empty label with point option
The set label command has a point option, which can be used to set a point using the existing point types at a certain coordinate:
set label at xPos, yPos, zPos "" point pointtype 7 pointsize 2
3. plot with '+'
The last possibility is to use the special filename +, which generates a set of coordinates, which are then filtered, and plotted using the labels plotting style (or points if no label is requested:
f(x) = x**2
x1 = 2
set xrange[-5:5]
set style line 1 pointtype 7 linecolor rgb '#22aa22' pointsize 2
plot f(x), \
'+' using ($0 == 0 ? x1 : NaN):(f(x1)):(sprintf('f(%.1f)', x1)) \
with labels offset char 1,-0.2 left textcolor rgb 'blue' \
point linestyle 1 notitle
$0, or equivalently column(0), is the coordinate index. In the using statement only the first one is taken as valid, all other ones are skipped (using NaN).
Note, that using + requires setting a fixed xrange.
This has the advantages (or disadvantages?):
You can use the usual pointtype.
You can only use the axis values as coordinates (like first or second for the objects above).
It may become more difficult to place different point types.
It is more involved using different border and fill colors.
The result is:
Adding to Christoph's excellent answers :
4. use stdin to pipe in the one point
replot "-" using 1:(f($1))
2.0
e
and use the method in 3rd answer to label it.
5. bake a named datablock
(version > 5.0) that contains the one point, then you can replot without resupplying it every time:
$point << EOD
2.0
EOD
replot $point using 1:(f($1)):(sprintf("%.2f",f($1))) with labels
6. A solution using a dummy array of length one:
array point[1]
pl [-5:5] x**2, point us (2):(3) pt 7 lc 3
7. Or through a shell command (see help piped-data):
pl [-5:5] x**2, "<echo e" us (2):(3) pt 7 lc 3
pl [-5:5] x**2, "<echo 2 3" pt 7 lc 3
8. Special filename '+'
pl [-5:5] x**2, "+" us (2):(3) pt 7 lc 3
It seems to be the shortest solution. But note that while it looks like a single point, these are like 500 points (see show samples) plotted on the same position.
To have only one point the sampling needs to be temporarily adjusted (see help plot sampling)
pl [-5:5] x**2, [0:0:1] "+" us (2):(3) pt 7 lc 3
9. Function with zero sampling range length
Shortest to type, but plotting as many points on top of each other as many specified with samples
pl [-5:5] x**2, [2:2] 3 w p pt 7 lc 3

Resources