1

I'm now trying to use filledcurve in gnuplot 4.6, patchlevel 1. Following shows the sample script:

set term epslatex
set output "figure.tex"

set xlabel "\\huge{x-axis}"
set ylabel "\\huge{y-axis}"
set format xy "\\LARGE{%.0f}"
set xrange [0.0:10.0]
set yrange [0.0:100.0]
set xtics 2.0
set ytics 20.0
set xtics offset 0, -0.3

f1(x) = x**1
f2(x) = x**2
f3(x) = x**3

set nokey
plot '+' using 1:(f2($1)):(f3($1)) with filledcurve lt 1 lc rgb "gray60",\
     '+' using 1:(f1($1)):(f2($1)) with filledcurve lt 1 lc rgb "gray40",\
     '+' using 1:(0.0):(f1($1))    with filledcurve lt 1 lc rgb "gray20"

I don't known why, but it seems that there are white annoying slits between bars. It cannot be get rid of even if I increase the number of set samples.

Is there any idea to remove these slits?

enter image description here

eng27
  • 906
  • 2
  • 8
  • 19
  • 2
    I have noticed this as well, but it seems to be a problem related to displaying the figure rather than a gnuplot problem. Maybe this display issue is triggered by how gnuplot generates the figure, that I do not know. If you import your eps file with GIMP, for instance, the white lines will be gone. Also, it does not have an effect when printing. – Miguel Apr 06 '14 at 07:33
  • Thanks, @Miguel. I have also checked that the lines do not exist when using "evince" (which is a linux command for displaying eps figures), and also when printing. However, if I put the eps figure into the latex file, the lines appear again. – eng27 Apr 06 '14 at 08:33
  • 1
    When I built a dvi file using `latex` and your script, the lines where gone, then came back when exporting to PDF using `dvipdf`. Perhaps if you fiddle a bit with the options passed to `dvipdf` you can prevent this from happening (I do not know), or use some different utility such as `dvipdfmx` or so. I will try and have a look when I get the chance, since I'm interested in this myself. – Miguel Apr 06 '14 at 09:46
  • See the bug report http://sourceforge.net/p/gnuplot/bugs/1259/ for a related discussion. – Christoph Apr 06 '14 at 10:26

1 Answers1

3

Unfortunately, this is a viewer problem related to the drawing of adjacent filled polygons, see also problematic Moire pattern in image produced with gnuplot pm3d and pdf output or the bug report #1259 cairolatex pdf fill patterns.

In your case you can use a workaround:

When you have only two columns in the using statement, the area is drawn as closed polygon and doesn't show these artifacts (filledcurves closed). So you must fill the area between each curve and the x1 axis (with filledcurves x1).

Because of a bug in the clipping of curves which exceed the y-range, you must do the clipping of the f3 curve yourself (i.e. use f3($1) > 100 ? 100 : f3($1)). This bug is fixed in the development version.

So you script is:

set term epslatex standalone
set output "figure.tex"

set xlabel "\\huge x-axis"
set ylabel "\\huge y-axis"
set format xy "\\LARGE %.0f"
set xrange [0.0:10.0]
set yrange [0.0:100.0]
set xtics 2.0
set ytics 20.0
set xtics offset 0, -0.3

f1(x) = x**1
f2(x) = x**2
f3(x) = x**3

set nokey
plot '+' using 1:(f3($1) > 100 ? 100 : f3($1)) with filledcurve x1 lt 1 lc rgb "gray60",\
     '+' using 1:(f2($1)) with filledcurve x1 lt 1 lc rgb "gray40",\
     '+' using 1:(f1($1)) with filledcurve x1 lt 1 lc rgb "gray20"

set output
system('latex figure.tex && dvips figure.dvi && ps2pdf figure.ps')

with the result (using 4.6.1):

enter image description here

Note also, that LaTeX commands like \huge don't take arguments, but are switches. Test e.g. \huge{A}BC, this will make all letter huge. Usually you must limit the scope of \huge with brackets like {\huge ABC}, but if the whole label is affected, it is enough to use set xlabel "\\huge x-axis". That doesn't change anything in your case, but may give you troubles in other circumstances :)

Community
  • 1
  • 1
Christoph
  • 47,569
  • 8
  • 87
  • 187