Open epagone opened 2 years ago
@epagone - thank you for your comments! ogpf uses data generated by Fortran! Sometimes these output are large files like several hundred kb!
I am not sure what is the benefit of data block in the case of ogpf! but I would welcome to give some example and explain the purpose a little more!
Thank you
Thanks for looking into my issue.
Sometimes these output are large files like several hundred kb!
This makes even a better case for using data blocks (expanded description follows).
I am not sure what is the benefit of data block in the case of ogpf! but I would welcome to give some example and explain the purpose a little more!
If you look at the linked Stacked Overflow question in my first message both your requests are addressed. The main advantage is to avoid repeating the same entire dataset in the script for each plot command that is using it.
Currently, ogpf
does something like (taken for the linked Stacked Overflow question):
set terminal gif
set output 'plot1.gif'
plot '-' using 1:2
1 10
2 20
3 32
4 40
5 50
e
and if you want to plot the same dataset with different plot specs you need to repeat the in-line data each time for each plot
command.
With data blocks (in the example called $data
), the data set is defined only once in the script and then can be re-used as many times as necessary:
$data << EOD
1 1
2 4
3 9
4 16
EOD
plot "$data" \
with linespoints \
title "my data"
I hope that it is now clearer.
The only drawback (as mentioned in my first message) is that this approach will fail with very old versions of gnuplot (i.e. older than about 7 years), but I guess that it is a reasonable request.
@epagone thank you! If you can make a PR I welcome to look into it and merge! If not let me to find some free time and do that!
We need to freeze the current version and start ne release to let people with old gnuplot can still use the library!
Thank you. Unfortunately, I do not see an opportunity in the next months, but I will try to have a look at this when things clear up a bit more.
Since version 5 (released almost 7 years ago) gnuplot offers data blocks, a more flexible way to in-line data for repeated plotting. It might be worth using this new functionality.