是否有可能得到以下输出,其中上图为红色,下图为蓝色
\documentclass[pstricks,border=17pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,linewidth=1pt}
\begin{document}
\begin{psgraph}{->}(0,0)(5,2.5){6cm}{5cm}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=orange]
{
\psplot{1}{4}{sqrt(x)}
\psplot{4}{1}{sqrt(x/2)}
}
\psplot[linecolor=red]{1}{4}{sqrt(x)}
\psplot[linecolor=blue]{4}{1}{sqrt(x/2)}
\end{psgraph}
\end{document}
仅使用一个\pscustom
内部\psgraph
(肯定不使用\psplot
外部!)?\pscustom
我的尝试如下,但由于两个图都是蓝色而失败。
\documentclass[pstricks,border=17pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,linewidth=1pt}
\begin{document}
\begin{psgraph}{->}(0,0)(5,2.5){6cm}{5cm}
\pscustom[linestyle=none]
{
\psplot{1}{4}{sqrt(x)}
\stroke[linestyle=solid,linecolor=red]
\gsave
\psplot{4}{1}{sqrt(x/2)}
\fill[fillstyle=solid,fillcolor=orange]
\grestore
\psplot[liftpen=2]{4}{1}{sqrt(x/2)}
\stroke[linestyle=solid,linecolor=blue]
}
\end{psgraph}
\end{document}
是否可以在单个笔画内构建多个具有不同颜色的笔画\pscustom
?
答案1
\documentclass[pstricks,border=17pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,linewidth=1pt}
\begin{document}
\begin{psgraph}{->}(0,0)(5,2.5){6cm}{5cm}
\pscustom[linestyle=none]
{
\psplot{1}{4}{sqrt(x)}
\gsave
\stroke[linestyle=solid,linecolor=red]
\psplot{4}{1}{sqrt(x/2)}
\fill[fillstyle=solid,fillcolor=orange]
\grestore
\newpath
\psplot[liftpen=2]{4}{1}{sqrt(x/2)}
\stroke[linestyle=solid,linecolor=blue]
}
\end{psgraph}
\end{document}
答案2
使用\pscustom
withgsave-grestore
似乎有些过度。
\documentclass[pstricks,border=17pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,linewidth=1pt}
\begin{document}
\begin{psgraph}{->}(0,0)(5,2.5){6cm}{5cm}
\pscustom[linestyle=none]
{
\gsave
\psplot{1}{4}{sqrt(x)}
\psplot{4}{1}{sqrt(x/2)}
\fill[fillstyle=solid,fillcolor=orange]
\grestore
\newpath
\psplot{1}{4}{sqrt(x)}
\stroke[linestyle=solid,linecolor=red]
\newpath
\psplot{4}{1}{sqrt(x/2)}
\stroke[linestyle=solid,linecolor=blue]
}
\end{psgraph}
\end{document}