Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot filled curves adds unwanted "bottom" border

I am trying to visualize a time series data set on one plot as a pseudo 3d figure. However, I am having some trouble getting the filledcurves capability working properly. It seems to be adding an unwanted border at the "bottom" of my functions and I do not know how to fix this.

This is my current set up: I have nb_of_frames different files that I want to plot on one figure. Without the filledcurves option, I can do something like this

plot for [i=1:nb_of_frames] filename(i) u ($1):(50.0 * $2 + (11.0 - (i-1)*time_step)) w l linewidth 1.2 lt rgb "black" notitle

which produces a figure like this: no fill options

enter image description here

Instead of doing this, I want to use the filledcurves option to bring my plots "forward" and highlight the function that is more "forward" which I try to do with:

plot for [i=1:nb_of_frames] filename(i) u ($1):(50. * $2 + (11. - (i-1)*time_step)) w filledcurves fc "white" fs solid 1.0 border lc "black" notitle

This produces a figure as follows: enter image description here

This is very close to what I want, but it seems that the border option adds a line underneath the function which I do not want. I have tried several variants of with filledcurves y1=0.0 with different values of y1, but nothing seems to work.

Any help would be appreciated. Thank you for your time.

like image 785
Eric Tovar Avatar asked Mar 15 '26 09:03

Eric Tovar


1 Answers

Here is another workaround for gnuplot 5.2.

Apparently, gnuplot closes the filled area from the last point back to the first point. Hence, if you specifiy border, then this line will also have a border which is undesired here (at least until gnuplot 5.4rc2 as @Ethan says).

A straightforward solution would be to plot the data with filledcurves without border and then again with lines. However, since this is a series of shifted data, this has to be plotted alternately. Unfortunately, gnuplot cannot switch plotting styles within a for loop (at least I don't know how). As a workaround for this, you have to build your plot command in a previous loop and use it with a macro @ (check help macros) in the plot command. I hope you can adapt the example below to your needs.

Code:

### filledcurves without bottom border
reset session
set colorsequence classic

$Data <<EOD
1  0
2  1
3  2
4  1
5  4
6  5
7  2
8  1
9  0
EOD

myData(i) = sprintf('$Data u ($1-0.1*%d):($2+%d/5.)',i,i)
myFill    = ' w filledcurves fc "0xffdddd" fs solid 1 notitle'
myLine    = ' w l lc rgb "black" notitle'

myPlotCmd = ''
do for [i=11:1:-1] {
    myPlotCmd = myPlotCmd.myData(i).myFill.", ".myData(i).myLine.", "
}

plot @myPlotCmd

### end of code

Result:

enter image description here

like image 182
theozh Avatar answered Mar 17 '26 03:03

theozh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!