4

I did search on here for a solution and I did read the manual, but i couldn't find an answer (or at least one that I understood).

I am plotting some data in a .csv file and for some reason when the x axis value goes above 930.08 it gives the error "Dimension too large". What is strange, though, I have other data that does exceed 930.08 and that works fine, although it starts at 800, not 930 - this "erroneous" data is essentially a segment of larger data range but each sample is at a smaller samplerate (original data: start=800, increment=0.25, end= 1100, new data: start=930, increment: 0.01, end=960).

The data which gives the error is

a,b,c
930.00,0.0001095886,0.03875491
930.01,0.0001499818,0.0448156
930.02,0.0001117049,0.03977829
930.03,0.0001122457,0.03972992
930.04,0.0001595432,0.04589581
930.05,9.773631e-05,0.03843789
930.06,0.0001590169,0.04583743
930.07,0.000153542,0.04522526
930.08,9.953637e-05,0.03739852

The data before 930.08 doesn't give the errors.

The code I am using to plot the graph is:

\begin{center}
    \begin{tikzpicture}
        \begin{loglogaxis}[black,
            width=14cm,
            height=10cm,
            mark=none,
            xlabel=Scaling Factor,
            transpose legend,
            legend style={at={(0.5,-0.15)},anchor=north},
            legend entries={MSE, Accuracy},
            legend style={nodes=right}]

            \addplot[no markers,blue] table [x=a, y=b, col sep=comma,] {
                ./chapter4/refined2b.csv
            };
            \addplot[no markers,red] table [x=a, y=c, col sep=comma,] {
                ./chapter4/refined2b.csv
            };
        \end{loglogaxis}
    \end{tikzpicture}
\end{center}

Many thanks to anyone who responds.

5
  • 1
    Welcome to TeX.sx! Apr 17, 2013 at 19:56
  • have you tried specifying ymax=<something>?
    – cmhughes
    Apr 17, 2013 at 19:57
  • Hi cmhughes, i tried doing "xmin=930,xmax=960,ymin=1e-7,ymax=2", which is roughly the range of coordinates, but this still gave the error. I think it has something to do with "axis equal", in the manual it says: "The axis equal key will be confused if x and y have a very different scale.", and in this plot this is certainly true. The default (false) gives the aforementioned error, if I change it to "true" the error disappears, but the plot is useless since all the plotted points are clumped together and you can't see them.
    – anderson
    Apr 17, 2013 at 20:07
  • Your x coordinate differences are too small to be distingished by a log plot. Using a semilogyaxis works without any problems.
    – percusse
    Apr 17, 2013 at 20:08
  • Thank you that fixed the problem (and explained it too), you've saved me a headache I really appreciate it.
    – anderson
    Apr 17, 2013 at 20:12

1 Answer 1

3

Possibly having very little steps in the x coordinates forces pgfplots to the numerical accuracy limits. Instead using the logarithmic axes for y and linear for x works without any problem.

\begin{semilogyaxis}[black,
    width=14cm,
    height=10cm,
    mark=none,
    xlabel=Scaling Factor,
    transpose legend,
    legend style={at={(0.5,-0.15)},anchor=north},
    legend entries={MSE, Accuracy},
    legend style={nodes=right}]

    \addplot[no markers,blue] table [x=a, y=b, col sep=comma,] {
        ./chapter4/refined2b.csv
    };
    \addplot[no markers,red] table [x=a, y=c, col sep=comma,] {
        ./chapter4/refined2b.csv
    };
\end{semilogyaxis}

You must log in to answer this question.

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