指定域和 pgfplots

指定域和 pgfplots

我正在制作具有特定域的图表pgfplots,但图表的域(x 和 y)没有变化。我正在阅读 pgfplots 手册,我认为我做的是正确的,只是它不起作用。

这是我的代码:

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[xlabel=$\mathrm{\frac{1}{[S]}}$,ylabel=$\mathrm{\frac{1}{\textit{V}_0}}$]
  \addplot+[scatter,domain=-100:10000,y domain=-0.05:0.05] coordinates {
    (10000, 0.030)
    (5000, 0.02)
    (2000, 0.014)
    (1000, 0.012)
    (500,  0.0110)
    (200,  0.0104)
    (100,  0.0102)
    (50,   0.010)
    (20,   0.01)
    (10,   0.01)
    (5,    0.01) 
  };

  \end{axis}
\end{tikzpicture}

\end{document}

答案1

手册(1.5 版第 34 页)说

这些domain键仅与gnuplot和相关plot expression。如果您只想绘制其他坐标输入例程的子集,请考虑使用坐标过滤器restrict x to domain

这限制了坐标的范围,但不会改变您获得的轴(它实际上移动了数据点)。我认为您只需要适用于轴的xmaxxminymax键:ymin

\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}
    [xlabel=$\mathrm{\frac{1}{[S]}}$,ylabel=$\mathrm{\frac{1}{\textit{V}_0}}$,
    xmin=-100,xmax=10000,ymin=-0.05,ymax=0.05]
  \addplot+[scatter] coordinates {
    (10000, 0.030)
    (5000, 0.02)
    (2000, 0.014)
    (1000, 0.012)
    (500,  0.0110)
    (200,  0.0104)
    (100,  0.0102)
    (50,   0.010)
    (20,   0.01)
    (10,   0.01)
    (5,    0.01) 
  };

  \end{axis}
\end{tikzpicture}

\end{document}

相关内容