[Tex/LaTex] Tikzpicture (pgfplot): Fixing curly braces and labels

diagramslabelstickstikz-pgf

I have a major problem (curly braces) and some minor issues I cannot resolve:

1) shift the second curly brace downwards so that both label the upper and lower interval with respect to the turning point "E0" (and find a better place for the labels "debtee/debtor")
2) adding "max" values to y=182 and x=178, how can I any arbitrary symbol to a ticks position? I can add the real number 182, but I want it to be like "x_2^{\max} \equiv 182"

\documentclass[13pt,a4paper,headlines=6,headinclude=true]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}       
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{intersections}
\begin{document}
\begin{center} 
\begin{tikzpicture}[scale=1.5]
  \begin{axis}[axis lines=middle,xmin=-1,xmax=189,ymin=-2,ymax=199,
    extra x ticks={178},
        extra y ticks={80, 182},
    xlabel=$\scriptstyle x_1$,
    ylabel=$\scriptstyle x_2$,
        tick label style={font=\tiny}, 
        ]
    \filldraw (100,80) circle (1pt)node[right,font=\tiny] {$E_0$};
    \filldraw (0,182) circle (1pt)node[right,font=\tiny] {$x_2^{\max}$};
        \filldraw (178,0) circle (1pt)node[right,font=\tiny] node[below] {$x_1^{\max}$};
        \addplot+[no marks,blue,domain=0:178,samples=200, thick] {182 - x*(1.02)};
        \path[draw=gray, dashed, thick] (100,0) -- (100,80);
        \path[draw=gray, dashed, thick] (0,80) -- (100,80);
        \draw [decorate, decoration={brace,amplitude=15pt,raise=1pt}] (0,182) -- (100,80)      node [midway, xshift=-1mm, auto, swap, outer sep=10pt,font=\tiny]{debtee};
    \draw [decorate, decoration={brace,amplitude=20pt,raise=2pt,mirror}] (100,80) -- (0,178) 
            node [midway, xshift=3mm, yshift=-1mm,auto, swap, outer sep=10pt,font=\tiny]{debtor};
  \end{axis}
\end{tikzpicture}
\end{center}
\end{document}

My result so far looks like this:

enter image description here

Thank you 🙂

Best Answer

In the second brace you used these coordinates:

(100,80) -- (0,178)

But the second couple should be inverted, because in this case it will be 0 on the X axis, and 178 on the Y axis, while it should be 0 on the Y and 178 on the X. Also, remove these options in the braces: mirror, auto, swap, and fix the shifts.

In order to change the labels for the extra ticks, write extra y tick labels={} and change it to x for the X axis.

Changes: I have added the pin option for some nodes (so they don't overlap the braces), and repositioned the axis labels.

Output

figure 1

Code

\documentclass[12pt,a4paper,headlines=6,headinclude=true]{scrartcl}
\usepackage{tikz,pgfplots}            

\pgfplotsset{compat=1.12}
\usetikzlibrary{intersections}

\tikzset{
    every pin/.style={font=\tiny, outer sep=0},
    every pin edge/.style={gray,very thin,shorten >=-1mm},
    small dot/.style={fill=black,circle,scale=0.3}
}

\begin{document}
\begin{figure}
    \centering
\begin{tikzpicture}[scale=1.5]
\begin{axis}[
    axis lines=middle,
    xmin=-1, xmax=189,
    ymin=-2, ymax=199,
    extra x ticks={178},
    extra y ticks={80, 182},
    extra y tick labels={80, $x_2^{\max} \equiv 182$},
    xlabel={$\scriptstyle x_1$},
    ylabel={$\scriptstyle x_2$},
    x label style={at={(axis description cs:1,0)},anchor=west},
    y label style={at={(axis description cs:0,1)},anchor=south},
    tick label style={font=\tiny}, 
]

\node[small dot, pin=45:{$E_0$}] at (100,80) {};
\node[small dot, pin=0:{$x_2^{\max}$}] at (0,182) {};
\node[small dot, pin=165:{$x_1^{\max}$}] at (178,0) {};

\addplot+[no marks,blue,domain=0:178,samples=200, thick] {182 - x*(1.02)};

\path [draw=gray, dashed, thick] (100,0) -- (100,80);
\path [draw=gray, dashed, thick] (0,80) -- (100,80);
\draw [decorate, decoration={brace,amplitude=15pt,raise=1pt}] (0,182) -- (100,80) node [midway, anchor=south west, xshift=-1mm, outer sep=10pt,font=\tiny]{debtee};
\draw [decorate, decoration={brace,amplitude=20pt,raise=2pt}] (100,80) -- (178,0) node [midway, anchor=south west, yshift=1mm, xshift=1mm, outer sep=10pt,font=\tiny] {debtor};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}