For coloring an area under a graph, there exist multiple approaches with pstricks.
I found a solution that was never mentioned on stack-exchange, but seems to be really simple:
\psplot[linewidth=1pt,linecolor=blue]{0.01}{5}{x log}
\pscustom[fillstyle=solid,fillcolor=cyan,linestyle=none]{%
\psline(3,0)(!3 dup log)
\psplot{3}{4}{x log}
\psline(!4 dup log)(4,0)}
\psaxes{->}(0,0)(-.5,-2)(5,1)
However, I do not know how to adapt this example to e.g. x^2
because I do not understand what dup
does. Can anybody explain it?
dup
means that the top stack entry is duplicated. See e.g. ugrad.math.ubc.ca/Flat/stack-ref.html#PSdup(!3 dup log)
evaluates to the coordinate (3,log(3)).