在图形下添加文本

在图形下添加文本

我画了这个图,我想在那个位置的红框上添加文字。 在此处输入图片描述 这是我的代码:

\begin{center}
\begin{tikzpicture}
 \begin{axis}[ 
  axis x line=center,
  axis y line=center,
  grid, 
  xmin=-0.2,
  xmax=11,
  ymin=-0.1,
  ymax=4.2,
  xlabel={$U_P(V)$}, 
  ylabel={$Q$ $l.min^{-1}$}, 
  xlabel style={below right},
  ylabel style={above left},]
 \addplot plot coordinates
 { (2.26,0) (3.02,0.4) (3.63,0.8) (4.30,1.2) (5.13,1.6) (5.85,2) (6.71,2.4) (7.43,2.8) (8.04,3.2) (8.78,3.6) (9.84,4)  };
 \end{axis}
\end{tikzpicture}
\end{center}

答案1

或者

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{center}
\begin{tikzpicture}
 \begin{axis}[ 
  axis x line=center,
  axis y line=center,
  grid, 
  xmin=-0.2,
  xmax=11,
  ymin=-0.1,
  ymax=4.2,
  xlabel={$U_P(V)$}, 
  ylabel={$Q$ $l.min^{-1}$}, 
  xlabel style={below right},
  ylabel style={above left},]
 \addplot plot coordinates
 { (2.26,0) (3.02,0.4) (3.63,0.8) (4.30,1.2) (5.13,1.6) (5.85,2) (6.71,2.4) (7.43,2.8) (8.04,3.2) (8.78,3.6) (9.84,4)  };
 \path (0,0) coordinate (O) (2.26,0) coordinate (X);
 \end{axis}
 \draw[stealth-stealth]  ([yshift=-1.5em]O) --
 node[below=1ex,draw=red,text=black,font=\tiny\bfseries] {zone morte} ([yshift=-1.5em]X);
% or 
%  \node[anchor=north west,draw=red,text=black,font=\tiny\bfseries] 
%  at (current axis.south west) {zone morte};
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

相关内容