gnuplot


Displaying markers on specific values in Gnuplot's line plot


I have data for a CDF in a file which looks like the following:
0.033 0.0010718113612
0.034 0.0016077170418
0.038 0.0021436227224
... ...
... ...
0.847 0.999464094319
0.862 1.0
First column is the X-axis value and the second column is the CDF value on Y-axis. I set the line style as follows:
set style line 1 lc rgb 'blue' lt 1 lw 2 pt 7 ps 0.75 # --- blue
and subsequently plot the line with the following:
plot file1 using 1:2 title 'Test Line CDF' with linespoints ls 1
This all works fine, the problem seems to be that my CDF file is pretty big (about 250 rows) and Gnuplot would plot the marker/point (a circle in this case) for every data point. This results in a very "dense" line because of the over-concentration of markers such that the underlying line is almost not visible as I show in an example image below:
How can I selectively draw the markers so that instead of having them on all data points, I plot them after every 50 data points, without having to decrease the number of data points (which I believe is what "every n" in the plot command would do) in my data file or decrease the marker size?
There is no need to use two plots commands, just use the pointinterval option:
plot 'data' pointinterval 5 with linespoints
That plots every line segment, but only every fifth point symbol.
The big advantage is, that you can control the behaviour with set style line:
set style line 1 lc rgb 'blue' lt 1 lw 2 pt 7 ps 0.75 pi 5
plot 'data' w lp ls 1
You can plot the same function twice, once with lines only, and then with points every n points. This will draw less points without decreasing the amount of segments. I think this is what you want to achieve. For this example I have done set table "data" ; plot sin(x) to generate numerical sampling of the sin(x) function.
What you have at the moment is:
plot "data" with linespoints pt 7
which gives
Now you can do the following:
plot "data" with lines, "data" every 10 with points pt 7 lc 1
which gives what you want:
You can change the styling to meet your needs.
Although #Miguel beat me to it, but I'm also posting my solution below:
The idea is to once draw the line and then draw the points with the "every n" specifier. I changed my own Gnuplot script in the following manner. A kind of hack but works:
set style line 1 lc rgb 'blue' lt 1 lw 2 pt 7 ps 0 # --- blue
plot file1 using 1:2 title '' with linespoints ls 1, "" using 1:2 every 20 title 'Test Line CDF' with points ls 1 ps 0.75
This retains the nice curve, without quantizing it too coarsely while also keeping the points much better spaced.

Related Links

Gnuplot Expand Plot to Fill Area
Extending value range in gnuplot
Auto-scale setting the window too small GNUPLOT
Gnuplot Data and Parametric
gnuplot: can a function be plotted with vectors?
Tab completion not working correctly in gnuplot
gnuplot with lines is not working
Add guiding lines over pm3d map in Gnuplot
How to plot a smooth surface in GNUplot?
Two plots on the same graph
Plot contours from one graph into another in Gnuplot
gnuplot: silent error reading (non-standard form of) scientific format numbers
gnuplot plotting against time-difference
grid lines are changed in multiplot if lines styles of y column is changed
Gnuplot: How to make scatter plots with transparent points
Gnuplot - How do not plot a piece of line for non-contiguous date/time

Categories

HOME
c++
solr6
jupyter-notebook
mono
microsoft-cognitive
userform
etcd
strongswan
css-modules
pivot-table
flannel
pthreads
webassembly
adodb-php
jxmaps
smt
cloudify
tv
xmlstarlet
workspace
jsdata
u2
android-appbarlayout
bing-api
lwip
python-tesseract
fread
chmod
layer
get-eventlog
package-name
android-debug
product-key
psftp
scada
oracle-data-modeler
shieldui
c#-6.0
jes
ffi
lpc
allegro5
javac
object-oriented-analysis
django-media
smartmeter
unicode-string
bisonc++
ucos
android-7.1-nougat
bubble-sort
ember-cli-mirage
nsoutlineview
nslog
leshan
pdfobject
twebbrowser
reportviewer2008
nested-function
dde
compass
apple-watch-complication
agile-project-management
codeigniter-restserver
classname
openoffice-writer
little-endian
graphic-effects
phpinfo
shapely
stunnel
realbasic
yard
zurb-foundation-5
mpld3
github-linguist
uiactivity
certificatestore
puphpet
wunderlist
rgs
automapper-3
django-1.7
pre-commit-hook
teamsite
syntactic-sugar
control-center
nools
restriction
triples
rhodecode
declarative-services
svggraph
avassetwriter
resourcedictionary
asp.net-compiler
ereg
facebook-events
mysql-5.0
ipad-2
jax-rpc
ios5.1
.lrc
nsformatter
google-doodle
visualtreehelper
cloning
nscoder
httpverbs
executequery
abbreviation
resource-cleanup
pdc2008
o3d

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App