5

I would like to graph the following function, 10000/(9999*e^(-0.125*x)+1) using Tikz and PGFplots but I can not seem to get it to work. I would like labels for the horizontal axis (t) and the vertical axis (I). I want the range of the function to be from 0 to 10,000 so I could see the asymptote being reached over time. However I can't seem to figure out how to make the two axes go up to 10,000 without making the axes itself too big to fit on paper.

I have used this so far, but I would like the tick marks to read 0, 1000, 2000, or something similar, up to 10000. Moreover, I do not want it to use scientific notation for the tick marks. My graph seems not to look like as I want it as well.

\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{mathtools}
\usepackage{tikz}
\begin{document} 

\begin{tikzpicture}
\begin{axis}[scaled ticks=false,xlabel=Time, ylabel=Infectious Individuals,xmin=0,ymin=0]
\addplot[domain=0:150, blue, ultra thick,smooth] {10000/(9099*e^(-0.125*x)+1)};
\end{axis}
\end{tikzpicture}
\end{document}

Edit -

I have been able to obtain - But I would like to draw an asymptote at 10000 as well as having the origin of the axis starting at 0,0 not as it is seen. Lastly, how would I go by adding labels for the axes?

enter image description here

12
  • Please provide what ever code you have so far
    – daleif
    Commented Dec 8, 2015 at 17:03
  • @daleif Yes I was attempting to.
    – H5159
    Commented Dec 8, 2015 at 17:07
  • @Frumpy Can you please make a minimal example that demonstrates the problem? Please eliminate all unnecessary code (for instance, you never use any of the macros you define, and you load a lot of packages). This will help us to focus a solution directly onto your problem. Thanks!
    – darthbith
    Commented Dec 8, 2015 at 17:11
  • @darthbith I am sorry, I was copying the same code from another post I made, which used it. I have fixed it.
    – H5159
    Commented Dec 8, 2015 at 17:13
  • 1
    Try adding the option h! to the figure environment, as in \begin{figure}[h!]. This influences the placement algorithm. See this post for more detail.
    – Herr K.
    Commented Dec 8, 2015 at 17:39

1 Answer 1

7

I think this does what you are asking. Since you don't say how the asymptote should look like, I've added some arbitrary options.

\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{mathtools}
\usepackage{tikz}
\begin{document} 

\begin{tikzpicture}
 \begin{axis}[
   scaled ticks=false,
   xmin=0,
   ymin=0,
   xlabel=x axis label,
   ylabel=y axis label,
   ]
    \addplot[domain=0:150, blue, ultra thick,smooth] {10000/(9999*e^(-0.125*x)+1)};
    \addplot[domain=0:150, gray, dashed] {10000};
\end{axis}
\end{tikzpicture}
\end{document}

By the way, is there a reason why you use version 1.8 on \pgfplotsset{compat=1.8}?

output

2
  • No, I've been trying for hours to learn how to use these two packages and some codes had that in the beginning so I had it left there. Is there a certain compete I should be using?
    – H5159
    Commented Dec 8, 2015 at 17:43
  • You should put the version of pgfplots you are using (the current one is 1.12). If a newer version is released with different default settings, this avoid changes in your plot.
    – LucaD
    Commented Dec 8, 2015 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .