2

I have two plots. How can I draw them?

Thank you

enter image description here

  • Could you be a bit more precise? There are so many ways, we need some more information. – vaettchen Jul 5 '15 at 20:30
5

Using TikZ, for example:

enter image description here

The code:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{patterns}

\def\Unit{2}

\begin{document}

\begin{tikzpicture}
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node[fill=white] 
  at (\Unit/3,\Unit/3)
  {$L^{\ast}$};
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};

\begin{scope}[shift={(2*\Unit,0)}]
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node
  at (\Unit,1.3*\Unit)
  (Last)
  {$L^{\ast}$};
\draw[->] 
  (\Unit/2,\Unit/2) -- (Last);  
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};
\end{scope}
\end{tikzpicture}

\end{document}

In a comment it was required to give a caption to each plot. I show two possibilities here: the first one, using one figure environment for each plot, and the second one with just one figure and two minipages so they are side-by-side:

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{patterns}

\def\Unit{2}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node[fill=white] 
  at (\Unit/3,\Unit/3)
  {$L^{\ast}$};
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};
\end{tikzpicture}
\caption{the first figure}
\label{fig:testa}
\end{figure}

\begin{figure}
\centering
\begin{tikzpicture}
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node
  at (\Unit,1.3*\Unit)
  (Last)
  {$L^{\ast}$};
\draw[->] 
  (\Unit/2,\Unit/2) -- (Last);  
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};
\end{tikzpicture}
\caption{the second figure}
\label{fig:testb}
\end{figure}

\begin{figure}
\begin{minipage}{.5\linewidth}
\centering
\begin{tikzpicture}
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node[fill=white] 
  at (\Unit/3,\Unit/3)
  {$L^{\ast}$};
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};
\end{tikzpicture}
\caption{the first figure}
\label{fig:testc}
\end{minipage}% <- don't delete this percentage symbol!
\begin{minipage}{.5\linewidth}
\centering
\begin{tikzpicture}
\fill[pattern=north east lines]
  (0,\Unit) -- (\Unit,0) -- (0,0) -- cycle;
\draw[->] 
  (-0.5,0) -- (\Unit+0.5,0);
\draw[->] 
  (0,-0.5) -- (0,\Unit+0.5);
\draw
  (0,\Unit) -- (\Unit,\Unit) -- (\Unit,0) -- cycle;
\node
  at (\Unit,1.3*\Unit)
  (Last)
  {$L^{\ast}$};
\draw[->] 
  (\Unit/2,\Unit/2) -- (Last);  
\node[left] at (0,\Unit) {$1$};
\node[below] at (\Unit,0) {$1$};
\end{tikzpicture}
\caption{the second figure}
\label{fig:testd}
\end{minipage}
\end{figure}

\end{document}

enter image description here

  • This code is very perfect. Thank you. Is that possible that I add separately captions to these plots? – David Mayar Jul 5 '15 at 20:52
  • 1
    @DavidMayar Use a tikzpicture environment for each plot, remove the scope environment from the second one and surround each one with a figure environment with its \caption. I can provide an example of the code but first tell me if they should be treated as two independant figures or as two subfigures. – Gonzalo Medina Jul 5 '15 at 20:55
  • I want to consider each of them as an independent figure. – David Mayar Jul 5 '15 at 20:57
  • 1
    @DavidMayar Please see my updated answer. – Gonzalo Medina Jul 5 '15 at 21:14

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.