绘制 .csv 数据时,PGFPlots 出现错误“尺寸太大”

绘制 .csv 数据时,PGFPlots 出现错误“尺寸太大”

我确实在这里寻找解决方案并且阅读了手册,但我找不到答案(或者至少我找不到答案)。

我正在 .csv 文件中绘制一些数据,出于某种原因,当 x 轴值超过 930.08 时,会出现错误“维度太大”。但奇怪的是,我还有其他数据超过了 930.08,虽然起始点是 800,而不是 930,但运行正常 - 这些“错误”数据本质上是较大数据范围的一部分,但每个样本的采样率都较小(原始数据:起始=800,增量=0.25,结束=1100,新数据:起始=930,增量:0.01,结束=960)。

产生错误的数据是

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

930.08 之前的数据没有出现错误。

我用来绘制图形的代码是:

\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}

非常感谢所有回复的人。

答案1

可能 x 坐标中的步长很小,会迫使pgfplots数值精度受限。相反,使用 y 轴的对数和 x 轴的线性则不会出现任何问题。

\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}

相关内容