1

I'm trying to make this graph of the two lines in Latex but for some reason the limits to the axis default to 1 immediately. I think it has something to do with how small my limits are but I'm not too sure.

enter image description here

My code:

\documentclass[11pt]{article}
\usepackage{pgfplots}

\begin{document}
\begin{figure}[H]
\begin{center}
        \begin{tikzpicture}[scale=1]
        \begin{axis}[
        clip mode=individual, 
        enlargelimits=false, grid=major,  xmax=0.000001,
        axis on top=false, ymax=1.2*0.001,
        xlabel=$x$, ylabel=$y$
        ]

    \coordinate (a) at (axis cs:0,0);
    \coordinate (b) at (axis cs:0.000001,1.1*0.001);
    \draw[thick] (a) -- (b);

    \end{axis}
    \end{tikzpicture}

\end{center}
\end{figure}
\end{document}
  • @marmot Do you have any idea on how to do that? Can I have the range as [0,1] and put by hand the x10^(-6)? – Bill May 3 '18 at 17:51
  • @percusse's answer is much better than my proposal. (You can put whatever with e.g. extra description/.code={\node[anchor=north] (description1) at (0.9,-0.1) {$\times 10^{-6}$};} but there is really no need for that.) – user121799 May 3 '18 at 18:08
2

You are not plotting but using TikZ directives. Plot the functions instead suchthat the axes can be automatically adjusted.

\documentclass[11pt]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[enlargelimits=false, grid=major,  ymax=1.2e-3,
    axis on top=false,xlabel=$x$, ylabel=$y$,no marks,domain=0:1e-6
    ]
    \addplot+[samples=3] {1100*x};
    \addplot+[samples=3] {100*x};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

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.