disturbing artifacts in pdf

前端 未结 5 870
时光取名叫无心
时光取名叫无心 2020-12-17 04:18

I\'m struggling with a problem when making plots with filledcurves. Between the filled areas, there seems to be a \"gap\". However, these artifacts do not appear on the prin

5条回答
  •  不思量自难忘°
    2020-12-17 04:49

    The problem is still present in Gnuplot 5.0.4 and at least the cairolatex terminal which I use to output PDFs. I also wanted to color the area between two curves, in my case defined as functions.

    When I used something like

    f(x) = 2 + sin(x)
    g(x) = cos(x)
    plot '+' using 1:(f($1)):(g($1)) with filledcurves closed
    

    I got the same vertical white lines as in the question.

    A simple solution for curves where one is always above the other is to let Gnuplot fill the area from the upper curve to the x-axis with the desired color and then paint it over with white from the lower curve downwards:

    f(x) = 2 + sin(x)
    g(x) = cos(x)
    plot f(x) with filledcurves x1, g(x) w filledc x1 fs lc rgb "white"
    

    Apparently this filledcurves style (not between curves but between a curve and an axis) avoids the trapezoid artifacts. This can be readily extended for plotting data files and multiple stacked cures like in the question. Just paint from top to bottom and finish with white for the empty area between the lowest curve and the x-axis.

    For overlapping curves a construction of minimum and maximum curves like in the answer from françois-tonneau might do the trick.

提交回复
热议问题