10

I'm making a graph with pgfplots with a specific domain, but the graph's domain (both x and y) are not changing. I'm reading through the pgfplots manual and I think I'm doing the right thing except that it's not working.

Here's my code:

\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}
6
  • Could you please reduce your example to a minimal working example (MWE).
    – N.N.
    Sep 22, 2011 at 20:30
  • It's not minimal yet. There are still packages that don't seem to be related to your problems. Have a look at the link I provided.
    – N.N.
    Sep 22, 2011 at 20:38
  • The only packages I have are lmodern, tikz, and pgfplots.
    – Miriam
    Sep 22, 2011 at 20:39
  • @Halime: I was just about to post an answer to your new question regarding the regression line. Have you figured out how to use the regression parameters yourself?
    – Jake
    Sep 23, 2011 at 3:37
  • @Jake: I realized that I already had the equation for the line of best fit, so I'd just plot the points for the x-intercept and an additional point. However, does pgfplots have a way of doing it instead of me computing it manually?
    – Miriam
    Sep 23, 2011 at 4:20

1 Answer 1

14

The manual (p. 34 for version 1.5) says

The domain keys are only relevant for gnuplot and plot expression. In case you’d like to plot only a subset of other coordinate input routines, consider using the coordinate filter restrict x to domain.

That restricts the domain of the co-ordinates, but does not alter the axes you get (it effectively moves the data points). I think you just want the xmax, xmin, ymax and ymin keys, which apply to the axis:

\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}
1
  • Thanks alot for your help! Also, what page of the manual are you citing? I'd just like to read more on that for my own reference.
    – Miriam
    Sep 22, 2011 at 21:38

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.