Vijay
Vijay

Reputation: 985

shading plot downward with different colors

I try to plot several graphs using multiplot option in gnuplot. I use the script as shown below.

#!/usr/bin/env gnuplot


#OUTPUT
#PNG
set terminal pngcairo size 600,550 enhanced dash #font "Arial-Bold,13" #fontscale 1.20
set output "Fill-Multi-plot-LDP-lyoSystemLast50ns.png"


#############################################################################

set style line 4 lt 1 lw 2.5  lc rgb "red"
set style line 5 lt 3 lw 2.5  lc rgb "forest-green"
set style line 6 lt 5 lw 2.5  lc rgb "blue"

#############################################################################
set macro
labelFONT="font 'Arial,18'"
scaleFONT="font 'Arial-Bold,14'"
scaleFONtt="font 'Helvetica,10'"
keyFONT="font 'Arial,10'"

#############################################################################

xsize = 0.80    # change this for expand in x direction
ysize = 0.22
xorigin = 0.022
yorigin = 0.02

#############################################################################
set xrange [-25.2:25.2] noreverse nowriteback
set yrange [0:2.5]  noreverse nowriteback
set xtic auto       @scaleFONT    # set xtics automatically
set ytic '' #0,0.2,0.4  @scaleFONT    # set ytics automatically
unset key

set size 1.0,1.0
set multiplot

#############################################################################
# plot A
set ylabel ""
set label "Distance in Angstrom" at -30.0,-0.22 @labelFONT
set label "Number Density" at -58,0.70  rotate by 90 left @labelFONT
set label "(e)" at 0,0.60   @scaleFONT
set origin xorigin,yorigin
set size xsize,(ysize+0.015)

plot    "bcm25perRS-251-300ns_head_tail_wat2.dat"   u 1:2 w filledcurves y1=0 fs transparent solid 0.35 ls 4, \
                ''          u 1:3 w filledcurves fs transparent solid 0.4 ls 5,\
                ''          u 1:4 w filledcurves fs transparent solid 0.5 ls 6


#################################################################################
# plot B
set xrange [-25.2:25.2]
set ylabel ""
unset label
set label "(d)"  at 0,0.60      @scaleFONT
set origin xorigin,(yorigin+0.19)
set size xsize,ysize+0.02

plot    "bcm25perS-251-300ns_head_tail_wat2.dat"    u 1:2 w filledcurves y1=0 fs transparent solid 0.35 ls 4, \
                ''          u 1:3 w filledcurves fs transparent solid 0.4 ls 5,\
                ''          u 1:4 w filledcurves fs transparent solid 0.5 ls 6


#################################################################################
## plot C
set xrange [-25.2:25.2]
set ylabel ""
unset label
set label "(c)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.385)
set size xsize,ysize+0.02

plot    "bcm25perR-251-300ns_head_tail_wat2.dat"    u 1:2 w filledcurves y1=0 fs transparent solid 0.35 ls 4, \
                ''          u 1:3 w filledcurves fs transparent solid 0.4 ls 5,\
                ''          u 1:4 w filledcurves fs transparent solid 0.5 ls 6


#################################################################################
# plot D
set xrange [-27.3:27.3] 
set xtics auto
set ylabel ""
unset label
set label "(b)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.58)
set size xsize,ysize+0.02

plot    "malto23per-251-300ns_head_tail_wat2.dat"   u 1:2 w filledcurves y1=0 fs transparent solid 0.35 ls 4, \
                ''          u 1:3 w filledcurves fs transparent solid 0.4 ls 5,\
                ''          u 1:4 w filledcurves fs transparent solid 0.5 ls 6

#################################################################################

# plot E
set xrange [-20.0:20.0] 
set xtics auto
set ylabel ""
unset label
set label "(a)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.77)
set size xsize,ysize+0.02

plot    "malto12per-251-300ns_head_tail_wat2.dat"   u 1:2 w filledcurves y1=0 fs transparent solid 0.35 ls 4, \
                ''          u 1:3 w filledcurves fs transparent solid 0.4 ls 5,\
                ''          u 1:4 w filledcurves fs transparent solid 0.5 ls 6

#################################################################################


## plot F
set size 0.3,0.5
set origin 0.76,0.55
set bmargin at screen 0
set key center center
set border 0 
unset xlabel
unset ylabel
unset label
unset tics
set format x ""
set format y ""
set yrange [0:1]
plot 2 ls 4 t 'Head', \
     2 ls 5 t 'Chain', \
     2 ls 6 t 'Water'
#, \
#     2 ls 10   t '151-200ns', \
#     2 ls 13   t '201-250ns', \
#     2 ls 16   t '251-300ns'
unset multiplot

Using this code I get a plot as shown here. multiplot with shaded regions.

The problem that I am facing here is the plot labeled (a) in the figure. The blue color shade must be downward. But it shades upward. The other figures (b), (c) and etc are correct.

The corresponding code for the figure label (a) is given in section #(PLOT E)# in the code. Especially the line for the blue shade is as follows: (u 1:4 w filledcurves fs transparent solid 0.5 ls 6).

I cannot figure out what is the mistake or error I made here.

(note: The order for the code and corresponding figures are upside down).

I appreciate any help for correcting this code. Many thanks in advance.

Upvotes: 1

Views: 795

Answers (1)

Christoph
Christoph

Reputation: 48390

You want to fill the area between the curve and the lower x-axis. This is done with the option x1:

plot 'file.dat' with filledcurves x1 fs transparent solid 0.5 ls 6

I think you can set x1 for all of your areas.

Upvotes: 1

Related Questions