0
votes

I have a XRD data and when I plot it I want to have this kind of graphexcel-scatter with smoothline. Anyway, excel has a problem to plot too large data and I want to plot it with Gnuplot and here is my code

set title "GNUPLOT RESULT"

set xlabel "Wavelength 2Theta"

set ylabel "Intensity"

set xrange [20:90]

set key right center

set terminal pngcairo size 1600, 1000 enhanced font "Arial,16"

set output "Allt-XRD.png"
plot  "AllW" using 1:2 w p pt 7 ps 2 lc rgb "orange" title "point", "AllW" using 1:2 smooth acspline lw 3 lc rgb 'blue' title 'spline'

But what it produces, GNUPLOT it does not connect all dots/points and I do not know but somehow it has a preferences (is it a weight point?) to connecting them.

Question

  • How can I connect all the dots as seen at excel graph with Gnuplot Thanks in advance

P.S: I tried all bunch of smooth version acscpline' cspline' bezier etc. it did not work

Edit 1: The line plot who wonders why I do not try it enter image description here

Edit 2: The worked answer of user8153 : Use decimal data point not an integer. Both spline and points option plot perfectly the data as it seen below spline

How XRD data looks like, it is too long so I pasted only a few of them

Wavelength = 1.54059 Å (Cu) 
Angle       Intensity
20.00243    1467
20.02869    1533
20.05495    1482
20.08121    1468
20.10747    1376
20.13374    1421
20.16000    1433
20.18626    1380
20.21252    1431
20.23878    1405
20.26504    1357
20.29130    1374
20.31756    1413
2

2 Answers

2
votes

Your with points plot shows that your data contains only integer values of the wavelength, but each value has multiple intensities associated with it. Is that really what the data should look like, or was there some mistake that chopped off the values of the wavelengths after the decimal point? Maybe your data file uses a symbol for the decimal point that gnuplot doesn't recognize? If so, use set decimalsign so gnuplot realizes that you are feeding it floating point numbers.

As it is, gnuplot does precisely what you tell it to do: it plots all these points at the same x coordinate, and connects them with lines if you use with lines, which are then by construction vertical.

0
votes

You told it to plot "with points pointtype 7 pointsize 2" (shorthand "w p pt 7 ps 2"). So it did. If you want it to plot with lines then say "with lines".

plot  "AllW" using 1:2 with lines lc rgb "orange" title "lines"