Give the following commands a try:
set xrange [-10:10]
set style function filledcurves above y1=0.0
set style fill transparent solid 0.5 noborder
plot sin(x) w filledcurves above y1=0.0, sin(x) w filledcurves below y1=0.0 ls 1
Or (the above, but change the plot line to):
plot sin(x) w filledcurves below y1=1.0
You also don't need to include the set style function filledcurves above y1=0.0
if you are using the w filledcurves ...
in your plot line, but you can (and you can also remove the w filledcurves ...
part of your plot line if you use the pre-mentioned line.
Typically in gnuplot, you can put commands on multiple lines and omit the semicolons. If you are on a nice linux system, it should be possible to create a script file, say graph.gnu
, add the lines of your script and the additional line #!/usr/bin/gnuplot -p
to the very top of the file, and then use chmod +x graph.gnu
. The script can now be executed and should display your graph.