我怎样才能绘制以下图表?

我怎样才能绘制以下图表?

我有两个图。我该如何绘制它们?

谢谢

enter image description here

答案1

使用TikZ, 例如:

enter image description here

代码:

\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}

在评论中,需要为每个图添加标题。我在这里展示了两种可能性:第一种,figure每个图使用一个环境;第二种,只使用一个figure和两个minipage,这样它们就并排了:

\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

相关内容