如何使用 PSTricks 填充指定区域

如何使用 PSTricks 填充指定区域

\psline我想要填充 PSTricks 绘图中形状的一些部分(在下图中用虚线标记):

% !TEX TS-program = latex    
\documentclass{standalone}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{epsfig}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\begin{document}
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-3.069199)(14.022783,3.089199)
\psbezier[linewidth=0.04](0.6365238,2.0708008)(1.2730476,2.842058)(4.0465226,1.8336606)(4.3165236,0.8708007)(4.5865245,-0.09205922)(2.9158728,-2.3652732)(1.9165238,-2.3291993)(0.9171748,-2.2931254)(0.0,1.2995436)(0.6365238,2.0708008)
\psellipse[linewidth=0.04,linestyle=dashed,dash=0.16cm 0.16cm,dimen=outer](3.5165238,-0.72919935)(1.6,1.2)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](3.0,0.35080063)(3.0,-1.6000001)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](2.7965238,0.27080062)(2.8,-1.8000001)
\psline[linewidth=0.08cm,arrowsize=0.05291667cm 2.0,arrowlength=1.4,arrowinset=0.4]{->}(5.98,-0.5108009)(7.98,-0.5108009)
\psline[linewidth=0.04cm,arrowsize=0.05291667cm 2.0,arrowlength=1.4,arrowinset=0.4]{->}(10.856523,-3.049199)(10.856523,2.6908007)
\psline[linewidth=0.04cm,arrowsize=0.05291667cm 2.0,arrowlength=1.4,arrowinset=0.4]{->}(8.256523,-0.58919936)(13.16,-0.5708009)
\psbezier[linewidth=0.04,linestyle=dashed,dash=0.16cm 0.16cm](10.036524,1.8708006)(10.83123,2.4777942)(11.258667,1.9593135)(11.676524,1.0508007)(12.094381,0.14228788)(11.856241,-2.2529888)(10.856523,-2.2291994)(9.856805,-2.20541)(9.241818,1.2638069)(10.036524,1.8708006)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,1.7908007)(11.236524,1.7908007)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,1.5108007)(11.436523,1.5108007)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,1.2308006)(11.516524,1.2308006)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,0.95080066)(11.636524,0.95080066)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.916524,0.6708007)(11.716524,0.6708007)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,0.35080063)(11.796524,0.35080063)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,0.07080064)(11.796524,0.07080064)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-0.20919935)(11.876524,-0.24919935)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-0.48919937)(11.716524,-0.48919937)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-0.80919933)(11.796524,-0.80919933)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-1.0891993)(11.756524,-1.0891993)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-1.3691994)(11.676524,-1.4091995)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.916524,-1.6491994)(11.436523,-1.6491994)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](10.876524,-1.9291993)(11.356523,-1.9291993)
\psdots[dotsize=0.16](3.716524,-0.96919936)
\usefont{T1}{ptm}{m}{n}
\rput(4.052344,-1.1041993){$y_0$}
\usefont{T1}{ptm}{m}{n}
\rput(1.992344,1.1358007){$\Omega$}
\usefont{T1}{ptm}{m}{n}
\rput(6.7723446,-0.30419937){$\varphi$}
\usefont{T1}{ptm}{m}{n}
\rput(4.982343,-2.2641995){$\mathcal{V}(y_0)$}
\usefont{T1}{ptm}{m}{n}
\rput(10.512345,-0.90419936){$0$}
\usefont{T1}{ptm}{m}{n}
\rput(10.822344,2.8958006){$\hat{x}_N$}
\usefont{T1}{ptm}{m}{n}
\rput(13.092344,-0.3041993){$x_N$}
\usefont{T1}{ptm}{m}{n}
\rput(11.8523445,-2.5041995){$\varphi(\mathcal{V}(y_0))$}
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](3.6,0.3691991)(3.6,-1.0108008)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](3.42,0.3691991)(3.42,-1.3108009)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](2.58,0.1891991)(2.58,-1.7108009)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](4.18,0.1891991)(4.18,0.28919908)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](3.22,0.3691991)(3.22,-1.4508009)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](3.82,0.32919908)(3.82,-0.67080086)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](4.02,0.28919908)(4.02,-0.27080092)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](2.42,-0.0308009)(2.42,-1.4308009)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](2.22,-0.2308009)(2.22,-1.2308009)
\psline[linewidth=0.04cm,linestyle=dashed,dash=0.16cm 0.16cm](2.02,-0.4708009)(2.02,-0.91080093)
\end{pspicture} 
}

\end{document}

答案1

您正在使用图形用户界面,它导出了糟糕的 PSTricks 代码。

\documentclass{standalone}
\usepackage[dvipsnames]{pstricks}
\begin{document}

\begin{pspicture}(0,-3.069199)(14.022783,3.089199)
\psclip{%
  \psbezier[linewidth=0.04](0.6365238,2.0708008)(1.2730476,2.842058)(4.0465226,1.8336606)
                (4.3165236,0.8708007)(4.5865245,-0.09205922)(2.9158728,-2.3652732)
                (1.9165238,-2.3291993)(0.9171748,-2.2931254)(0.0,1.2995436)(0.6365238,2.0708008)
  \psellipse[fillstyle=solid,fillcolor=red!30](3.5165238,-0.72919935)(1.6,1.2)
  }
\endpsclip
\psbezier[linewidth=0.04](0.6365238,2.0708008)(1.2730476,2.842058)(4.0465226,1.8336606)
                (4.3165236,0.8708007)(4.5865245,-0.09205922)(2.9158728,-2.3652732)
                (1.9165238,-2.3291993)(0.9171748,-2.2931254)(0.0,1.2995436)(0.6365238,2.0708008)
\psellipse(3.5165238,-0.72919935)(1.6,1.2)
\psclip{%
  \psbezier[linewidth=0.04,linestyle=dashed](10.036524,1.8708006)
      (10.83123,2.4777942)(11.258667,1.9593135)(11.676524,1.0508007)(12.094381,0.14228788)
      (11.856241,-2.2529888)(10.856523,-2.2291994)(9.856805,-2.20541)(9.241818,1.2638069)
     (10.036524,1.8708006)}
  \psframe[fillstyle=solid,fillcolor=red!30,linestyle=none](10.856523,-3)(13,3)
\endpsclip
\psline[linewidth=0.08cm,arrowsize=0.05291667cm 2.0]{->}(5.98,-0.5108009)(7.98,-0.5108009)
\psline[linewidth=0.04cm,arrowsize=0.05291667cm 2.0]{->}(10.856523,-3.049199)(10.856523,2.6908007)
\psline[linewidth=0.04cm,arrowsize=0.05291667cm 2.0]{->}(8.256523,-0.58919936)(13.16,-0.5708009)
\psdots[dotsize=0.16](3.716524,-0.96919936)
\rput(4.052344,-1.1041993){$y_0$}
\rput(1.992344,1.1358007){$\Omega$}
\rput(6.7723446,-0.30419937){$\varphi$}
\rput(4.982343,-2.2641995){$\mathcal{V}(y_0)$}
\rput(10.512345,-0.90419936){$0$}
\rput(10.822344,2.8958006){$\hat{x}_N$}
\rput(13.092344,-0.3041993){$x_N$}
\rput(11.8523445,-2.5041995){$\varphi(\mathcal{V}(y_0))$}
\end{pspicture} 

\end{document}

在此处输入图片描述

相关内容