0

I was able to draw the first function thanks to the help of a user here. However, my second function can't be plotted due to the (common?) "dimension too large" problem. I have read many threads about this yet I haven't found a solution:

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage[normalem]{ulem} 
\usepackage{tikz} 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
        \begin{axis}[grid=major,ymax=10000,xmax=10000,xmin=0,ymin=0]
          \addplot[no markers, blue, domain=0:10000, samples=10, % you can make it larger 
          %restrict y to domain=0:1714,% but this filter the results anyway
          samples=300 
          ] { 93231-3.552e-10*x^5};
        \end{axis}
\end{tikzpicture}

\end{document}

Help is much appreciated as I urgently need this function.

Actually this one goes through, but shows no plot at all:

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage[normalem]{ulem} 
\usepackage{tikz} 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}



\begin{tikzpicture}
        \begin{axis}[grid=major,ymax=10000,xmax=10000,xmin=0,ymin=0]
          \addplot[no markers, blue, domain=0:10000, samples=10, % you can make it larger 
          restrict x to domain=0:5000,% but this filter the results anyway
    restrict y to domain=0:100000,
          samples=300 
          ] { 93231-3.552e-10*x^5};
        \end{axis}
\end{tikzpicture}


\end{document}
2
  • 1
    In the second example, change ymax=10000 to ymax=100000. The plot is outside of the grid area.
    – gernot
    Mar 16, 2017 at 9:35
  • What is the function that you actually want to plot? Can you present it in typeset form?
    – gernot
    Mar 16, 2017 at 9:42

1 Answer 1

1

I agree with gernot's comment below the question.

If you just need to plot the positive part of the function, than you can reduce your code drastically by just setting the appropriate axis limits and the domain. So the following is hopefully what you are looking for.

To find out what the limits are, you could have first plotted the whole plot without specifying axis limits (and restrictions like restrict x to domain) and then adapt domain to fit your needs. When this is in the range where you need it, you can adapt the axis limits. This should in most cases avoid the "dimension too large error".

% PGFPlots v1.14
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        grid=major,
        xmin=0,
        xmax=1000,
        ymin=0,
        ymax=1e5,
    ]
        \addplot [
            no markers,
            blue,
            domain=0:1500,
            smooth,
          ] {93231-3.552e-10*x^5};
        \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

You must log in to answer this question.

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