Just as the title said I need to fill some space in different figures (created using pspicture) but I do not know how to do it when the space is not delimited by straight lines. In that case I use \pspolygon and that's all. Could yo help me and teach me how to do that? I need to do it in like 4 or 5 figures and I put down belong the code of one of them. Thanks so much to everyone that could help me. This is the code:




\definecolor{colour0}{rgb}{0.2,0.2,1.0} %Azul
\definecolor{colour1}{rgb}{1.0,0.0,0.2} %Rojo
\definecolor{colour2}{rgb}{0.8,0.8,0.8} %Gris claro (linea punteada)
\definecolor{colour3}{rgb}{0.0,0.2,1.0} %Azul
\definecolor{colour4}{rgb}{0.2,0.6,0.0} %Verde
\definecolor{bubblegum}{rgb}{0.99, 0.76, 0.8}
%Además, se usan colores:
%MidnightBlue: Curva IC
%LimeGreen: Curva PC
%Black: Ejes
%Gray: Región de soluciones

\psline[linecolor=black, linewidth=0.03,  arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(0.810012,-1.6741458)(0.810012,9.125854)
\psline[linecolor=black, linewidth=0.03, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(0.810012,-1.6741458)(11.110012,-1.6741458)

%Region de soluciones
%\pspolygon[linecolor=colour2, linewidth=0.02, fillstyle=solid,fillcolor=colour2, opacity=0.3](3.2,3.39)(0.838,5.17)(0.838,8.47)(9.710012,8.4741458)

%Curva LLC
%\psline[linecolor=bubblegum, linewidth=0.02, linestyle=dashed](0.835, -1.65)(0.835, 8.95)
%\psline[linecolor=bubblegum, linewidth=0.02, linestyle=dashed](0.84,-1.65)(10.85,-1.65)
%Curva IC
\psbezier[linecolor=MidnightBlue, linewidth=0.05](0.8, 2)(5, 3.8)(7, 6)(8.6, 8.5)
%Curva PC
\psbezier[linecolor=LimeGreen, linewidth=0.05](0.83, 6)(1.5, 3.9)(5.655, -0.6)(9.65, -1.67)
%Curva Isocosto
\psline[linecolor=LimeGreen, linewidth=0.05](1.2, 3.6)(4.5, 2.35)
\psline[linecolor=LimeGreen, linewidth=0.05](3.4, 1.5)(6.8, 0.212121214)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](1.3, 3.55)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](1.7, 3.41)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](2.1, 3.26)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](2.5, 3.1)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](2.9, 2.95)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](3.3, 2.81)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](3.7, 2.65)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](4.1, 2.49)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](4.5, 2.357)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](5, 1.95)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](5.5, 1.55)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](6, 1.15)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](6.5, 0.75)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](7, 0.4)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](7.5, 0.0)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](8, -0.4)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](8.5, -0.8)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](9, -1.2)
%\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.2](9.5, -1.55)
%Optimal Incentive S.
%\psline[linecolor=bubblegum, linewidth=0.05](3.21, 3.33)(0.8,5.2)

%TEXTO AGREGADO (Números, Letras, etc)
\rput[bl](2.67, -2.2076814){$w^{k}_{\scriptscriptstyle{F}}$}
\rput[bl](4.9, -2.2076814){$w^{t}_{\scriptscriptstyle{F}}$}
\rput[bl](9.1, -2.7){$\left[\frac{\underline{U}}{1-p}\right]^{\frac{1}{1-\gamma}}$}

\rput[bl](-0.5, 1.75){$\left[\frac{B}{p}\right]^{\frac{1}{1-\gamma}}$}
\rput[bl](0.13, 2.9){$w^{*}_{\scriptscriptstyle{E}}$}
\rput[bl](-0.5, 5.75){$\left[\frac{\underline{U}}{p}\right]^{\frac{1}{1-\gamma}}$}

\rput[bl](0.5, -2.1076814){$0$}
\rput[bl](5.1, 3.2){$(w^{*}_{\scriptstyle{F}},w^{*}_{\scriptstyle{E}})$}

%Interseccion UNO
\psdots[linecolor=black, dotsize=0.1](2.81, 2.99)
%Línea horizontal punteada de intersección
\psline[linecolor=black, linewidth=0.0, linestyle=dashed, dash=0.18cm 0.11cm](0.810012, 2.99)(2.82, 2.99)
%Línea vertical punteada de intersección
\psline[linecolor=black, linewidth=0.0, linestyle=dashed, dash=0.18cm 0.11cm](2.81, -1.6741458)(2.81, 2.99)
\psline[linecolor=black, linewidth=0.02,  arrowsize=0.05cm 2.0, arrowlength=1.4, arrowinset=0.0]{->}(2.81, 2.99)(5, 3.4)

%Interseccion DOS
\psdots[linecolor=black, dotsize=0.1](5.07, 0.86)
%Línea vertical punteada de intersección
\psline[linecolor=black, linewidth=0.0, linestyle=dashed, dash=0.18cm 0.11cm](5.07, -1.6741458)(5.07, 0.85)

\psframe[linecolor=black, linewidth=0.01, fillstyle=solid, dimen=outer](16.070012,2.5)(10.110012,5.35)
%Referencia gráfica
%Optimal Incentive S.
%\psline[linecolor=bubblegum,linewidth=0.05](10.480012, 5.3858546)(11.1133455, 5.3858546)%1
%PC (binding)
\psline[linecolor=LimeGreen, linewidth=0.05](10.480012,4.85)(11.1133455,4.85)%2
%IC (binding)
\psline[linecolor=MidnightBlue, linewidth=0.05](10.480012,4.395854)(11.1133455,4.395854)%3
%LLC (binding)
\psline[linecolor=bubblegum, linewidth=0.05, linestyle=dashed, dash=0.13638889cm 0.10583334cm](10.480012,3.88)(11.1133455,3.88)%4
%Isocost %5
\psline[linecolor=LimeGreen, linewidth=0.05, 0.10583334cm](10.480012,3.45)(11.1133455,3.45)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](10.52, 3.45)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](10.80, 3.45)
\psdots[linecolor=black,fillcolor=white, dotstyle=o, dotsize=0.15](11.08, 3.45)
%Region solutions
\pspolygon[linecolor=gray, linewidth=0.02, fillstyle=solid,fillcolor=colour2, opacity=0.3](10.4, 2.85)(11.25, 2.85)(11.25, 3.05)(10.4, 3.05)%6

%\rput[bl](11.4733574, 5.2191876){\footnotesize : Optimal Incentive Scheme}%1
\rput[bl](11.4733574, 4.7191875){\footnotesize : PC (binding)}%2
\rput[bl](11.4733574, 4.2191876){\footnotesize : IC (binding)}%3
\rput[bl](11.4733574, 3.7191876){\footnotesize : LLC (binding)}%4
\rput[bl](11.4733574, 3.34){\footnotesize : Isocost}%5
\rput[bl](11.4733574, 2.8){\footnotesize : Region of feasible solutions}%6


{\footnotesize \textbf{Figure 8.} Linear incentives, risk aversion & limited liability.}


I need to fill the space using solid color Gray and in the next figure I highlighted the area with red lines. And also the curves that enclose the space are written on the lines 45 and 47. enter image description here

Thanks again, I really need to do that and I do not know how to even start :/


I have some regex search and replace which converts most of PSTricks code to TikZ, but is far from perfect. While I am sure you can do that in PSTricks (with \pscustom if I remember correctly), you may just switch to TikZ with which it is really easy.

name=xhatch, parameters={\hatchsize,\hatchangle,\hatchlinewidth}, 
bottom left={\pgfpoint{-.1pt}{-.1pt}},
top right={\pgfpoint{\hatchsize+.1pt}{\hatchsize+.1pt}}, tile size={\pgfpoint{\hatchsize}{\hatchsize}},
tile transformation={\pgftransformrotate{\hatchangle}}, code={
} }
hatch size/.store in=\hatchsize,
hatch angle/.store in=\hatchangle,
hatch line width/.store in=\hatchlinewidth, 
hatch size=5pt,
hatch angle=45,
hatch line width=.5pt,



\begin{tikzpicture}[area/.style={pattern=xhatch,pattern color=red}]

\definecolor{bubblegum}{rgb}{0.99, 0.76, 0.8}
 \clip (0.8,8.5) --
 (0.8, 2) .. controls (5, 3.8) and (7, 6) .. (8.6, 8.5) |- cycle;
 \path[area] (0.8,8.5) --
 (0.83, 6) .. controls (1.5, 3.9) and (5.655, -0.6) .. (9.65, -1.67) |- cycle;

    (0.810012,9.125854) node[below left] {$w_{\scriptscriptstyle{E}}$} 
    |- (11.110012,-1.6741458)   node[below] {$w_{\scriptscriptstyle{F}}$}
    node[pos=0.5,below left]{$0$};
    (0.8, 2) .. controls (5, 3.8) and (7, 6) .. (8.6, 8.5);
    (0.83, 6) .. controls (1.5, 3.9) and (5.655, -0.6) .. (9.65, -1.67)
    (1.2, 3.6)--(4.5, 2.35)
    (3.4, 1.5)--(6.8, 0.212121214);
\draw plot[only marks,mark=*,mark options={fill=white,draw},mark size=2pt] 
    {(1.3, 3.55)(1.7, 3.41)(2.1, 3.26)(2.5, 3.1)(2.9, 2.95)(3.3, 2.81)(3.7, 2.65)(4.1, 2.49)(4.5, 2.357)};
(0.8, 2) node[left] {$\left[\frac{\underline{B}}{p}\right]^{\frac{1}{1-\gamma}}$}
(0.83, 6) node[left] {$\left[\frac{\underline{U}}{p}\right]^{\frac{1}{1-\gamma}}$}
(9.65, -1.67) node[below] {$\left[\frac{\underline{U}}{1-p}\right]^{\frac{1}{1-\gamma}}$};  

\draw[dashed] (0.810012, 2.99) node[left] {$w^{*}_{\scriptscriptstyle{E}}$} -| (2.81, -1.6741458)
 (5.07, -1.6741458)  node[below]{$w^{t}_{\scriptscriptstyle{F}}$} -- (5.07, 0.85);

\path (11,5) node[matrix,draw]{
 \draw[thick,bubblegum] (0,0) -- (2em,0) node[right] {PC (binding)};\\
 \draw[thick,LimeGreen] (0,0) -- (2em,0) node[right] {IC (binding)};\\
 \draw[thick,MidnightBlue] (0,0) -- (2em,0) node[right] {LLC (binding)};\\
 \draw plot[mark=*,mark options={fill=white,draw},mark size=2pt] 
  coordinates {(1pt,0) (1em,0) (2em-1pt,0)} (2em,0) node[right] {Isocost};\\
 \draw[area] (0,-1ex) rectangle (2em,1ex)
 (2em,0) node[right]{Region solutions}; \\
\caption{Linear incentives, risk aversion \& limited liability.}

enter image description here

And with


it becomes

enter image description here

| improve this answer | |
  • Thank you so much! I will try to learn how to create figures using TikZ, its seem to be easier. Thanks again :) – oldenios Mar 31 at 0:56
  • @oldenios You're welcome! I was using PSTricks for a very long time but a few years ago I switched to TikZ. For a long time I was hesitating because I have the large "database" of PSTricks pictures on my hard drive (which is why I have the regex search & replace macros in my editor) but now I think it really payed of to switch. – Schrödinger's cat Mar 31 at 1:00
  • And you are so good in TikZ! I've take a look in your profile and the answers are awesome haha, I hope someday to be that good. Could I ask to you a little question about another figure? I think there is a very little detail that I need to know to solve my problem :(. Or is it better to upload a new question? – oldenios Mar 31 at 1:03
  • @oldenios If you don't mind, I think the cleanest way is to post a question, which is free of charge. Then you get the opinion of several users, and, more importantly, others can learn from the thread, which is what this site is for. – Schrödinger's cat Mar 31 at 1:05
  • No problem! I'm writing it right now. Thanks again, this site is awesome bc there are people like you and I've learn a several things. :) – oldenios Mar 31 at 1:07

I think you use the software to draw it!

The following code works:

%LimeGreen: Curva PC
%Black: Ejes
%Gray: Región de soluciones

        \psbezier(0.8, 2)(5, 3.8)(7, 6)(8.6, 8.5)
        \psline(0,8.5)(0.83, 6)
        \psbezier(0.83, 6)(1.5, 3.9)(5.655, -0.6)(9.65, -1.67)
% or \psframe[fillstyle=vlines](0.810012,-1.6741458)(9,9.125854)
\psframe[fillstyle=solid,fillcolor=white,linestyle=none](0.8, -1.5)(9.13, 2.955)


enter image description here

| improve this answer | |
  • Thank you so much, that is exactly what I need. I checked the code to understand it and be able to replicate it and I have a question: What is the exact purpose of the \psframe? I don't understand the points you used: (0.8, -1.5) (9.13, 2.955) Thanks again pal :) – oldenios Mar 30 at 19:26
  • Help me pls @justonly, I can't understand why you chose twose points (0.8, -1.5) (9.13, 2.955). I need to do that in a few more figures but I do not know how to determine those points in the others figures. Thx – oldenios Mar 31 at 0:24
  • @oldenios two points (0.8, -1.5) (9.13, 2.955) are choosen by hands ... :-) – user197952 Mar 31 at 0:26
  • @oldenios If you don't use the second \psframe command, what do you see? That points can be replaced by the different ones, as long as the excess part is filled by \psframe ... – user197952 Mar 31 at 0:31
  • If I don't use the second \psframe it produces another figure (same characteristics to the first one) to the opposite side of the middle point. I do not know how to choose it in the other figures :( – oldenios Mar 31 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.