这是我的代码。
\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pstricks-add,pst-plot,pst-func}
\begin{document}
\def\funcone{6-x}
\def\functwo{7-x}
\begin{pspicture}(-1,-1)(8,8)
\psplot[linestyle=dashed,linecolor=red,algebraic]{0}{6}{\funcone}
\psplot[linestyle=dashed,linecolor=red,algebraic]{0}{7}{\functwo}
% \psplotImp[linecolor=red,stepFactor=0.1](0,-1)(6,5){x^2+x*y+y^2-8*x-7*y+15}
\psaxes[showorigin=false]{->}(0,0)(-.5,-.5)(8,8)[$x$,-90][$y$,0]%[labels=none,ticks=none]
\psclip[linestyle=none]{%
\psplotImp[stepFactor=0.1,algebraic](-1,-1)(7,7){ x^2+x*y+y^2-8*x-7*y+15 }}
\pscustom[fillstyle=solid,fillcolor=green!80!orange,algebraic]{%
\psplot{0}{6}{\funcone}
\psplot{7}{0}{\functwo}
\closepath}
\endpsclip
\end{pspicture}
\end{document}
输出图片
它应该是
注意:如果您想引入一些新的东西,您可以重现我的代码!
另一种使用方式pst-contourplot
!
\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pst-contourplot,pstricks-add}
\begin{document}
\def\funcone{6-x}
\def\functwo{7-x}
\begin{pspicture}(-1,-1)(8,8)
\psaxes[showorigin=false]{->}(0,0)(-.5,-.5)(8,8)[$x$,-90][$y$,0]
\psclip[linestyle=none,algebraic]{%
\pscustom{\psplot{0}{6}{\funcone} \psplot{7}{0}{\functwo} \closepath} }
\psContourPlot[algebraic,
a=0.05,
linecolor=red,
Fill,fillcolor=green!50!orange,
function=x^2+x*y+y^2-8*x-7*y+15](-1,-1)(7,7)
\endpsclip
\psplot[linestyle=dashed,linecolor=red,algebraic]{0}{6}{\funcone}
\psplot[linestyle=dashed,linecolor=red,algebraic]{0}{7}{\functwo}
\psContourPlot[algebraic,a=0.05,linecolor=red,function=x^2+x*y+y^2-8*x-7*y+15](-1,-1)(7,7)
\end{pspicture}
\end{document}
答案1
您不能使用 \pstPlotImp,该线不是函数。那只是单个点。但是,\psellipse[rot=-45](3,2)(2.85,1.65)
是相同的曲线。
\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(-1,-1)(8,8)
\psaxes[showorigin=false]{->}(0,0)(-.5,-.5)(8,8)[$x$,-90][$y$,0]
\psclip{\psellipse[rot=-45,linestyle=none](3,2)(2.85,1.65)}
\pspolygon[linestyle=none,fillstyle=solid,fillcolor=red!50](6,0)(7,0)(0,7)(0,6)
\endpsclip
\psellipse[rot=-45,linestyle=dashed](3,2)(2.85,1.65)
\psset{linecolor=red,linestyle=dashed}
\psline(7,0)(0,7)
\psline(6,0)(0,6)
\end{pspicture}
\end{document}