答案1
\documentclass{article}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}[showgrid](-1,-1)(4,4)
\psline{<->}(0,3)(0,0)(4,0)
\pscustom[,fillstyle=solid,fillcolor=gray,linestyle=none]{%
\psplot[plotstyle=curve]{.67}{4}{2 x div}
\psline(4,3)
}
\psline[linecolor=blue,linewidth=1.5pt](0.67,3)(4,3)(4,0.5)
\end{pspicture}
\end{document}
答案2
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot}
% Best Practices:
% do always enclose the parameters #1, #2, etc with ()
% do always enclose the most outside with ()
% Are you wondering why?
\def\f(#1){(2/(#1))}
\def\x0{(2/3) }% the last whitespace is not trivial!
% infix to postfix operator
\pstVerb{/I2P {AlgParser cvx exec} def}
\begin{document}
\begin{pspicture}[algebraic](-1,-1)(4,4)
\psaxes{<->}(0,0)(-1,-1)(4,3)[$x$,0][$y$,90]
\pscustom[fillstyle=solid,fillcolor=gray,linestyle=none]{
\psplot{\x0 I2P}{4}{\f(x)}
\lineto(4,3)
}
\psline[linecolor=blue,linewidth=1.5pt](*4 {\f(x)})(4,3)(*{\x0 I2P} {\f(x)})
\end{pspicture}
\end{document}
笔记:
(*{abscissa} {ordinate})
在哪里
- 在 Postfix 中,横坐标必须是常数。
x
纵坐标必须是Infix的函数。