任何帮助我都会很感激。我读过一些类似的问题,但与我的问题不同。我正在尝试使用 pgfplots 在独立的 .tex 文件中创建图像。我有一个 CSV 文件,其中的数据如下所示。
dt,dp,dE
1.000000000,0.000010000,-3.656612577
10.000000000,0.000010000,-2.656180402
100.000000000,0.000010000,-1.651866238
1000.000000000,0.000010000,-0.607901729
10000.000000000,0.000010000,0.903554942
100000.000000000,0.000010000,3.532851491
1.000000000,0.000100000,-3.693263127
10.000000000,0.000100000,-2.692898714
100.000000000,0.000100000,-1.689273832
1000.000000000,0.000100000,-0.652898064
10000.000000000,0.000100000,0.672648732
100000.000000000,0.000100000,1.546957027
1.000000000,0.001000000,-4.981641553
10.000000000,0.001000000,-3.981670379
100.000000000,0.001000000,-2.982019408
1000.000000000,0.001000000,-1.985481315
10000.000000000,0.001000000,-1.022172045
100000.000000000,0.001000000,-0.408245334
1.000000000,0.010000000,-6.524022325
10.000000000,0.010000000,-5.524522779
100.000000000,0.010000000,-4.524520125
1000.000000000,0.010000000,-3.524410901
10000.000000000,0.010000000,-2.523458696
100000.000000000,0.010000000,-1.517634245
1.000000000,0.100000000,-8.595381336
10.000000000,0.100000000,-7.538480264
100.000000000,0.100000000,-6.538303992
1000.000000000,0.100000000,-5.538261116
10000.000000000,0.100000000,-4.537841077
100000.000000000,0.100000000,-3.537098665
1.000000000,1.000000000,-10.540334260
10.000000000,1.000000000,-9.538196497
100.000000000,1.000000000,-8.540547543
1000.000000000,1.000000000,-7.540192616
10000.000000000,1.000000000,-6.539782772
100000.000000000,1.000000000,-5.539092363
我的 pgfplots 代码是
\documentclass[tikz]{standalone}
\usepackage{pgfplots,pgfplotstable}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{physics}
\pgfplotsset{compat=newest}
\usetikzlibrary{matrix}
\usepgfplotslibrary{units}
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false, colorbar,point meta = explicit,ymode=log,xmode=log,colorbar style={title=${\log_{10}(\flatfrac{\Delta E}{E_0})}$},axis on top,ylabel={Initial momentum, $p_x$}, y unit = {\si{\giga\electronvolt}}, x unit = {\si{\per\giga\electronvolt}},xlabel = {Timestep, $\Delta t$},xmin=0.316227766,xmax=316227.766,ymax=3.16227766,ymin=0.00000316227766]
\addplot[matrix plot,mesh/cols=6,mesh/rows=6] table[x = dt,y = dp,col sep = comma, meta = dE]{EnergyMatrixCromerALD.csv};
\end{axis}
\end{tikzpicture}
\end{document}
我得到的错误是
! Illegal unit of measure (pt inserted).
<to be read again>
Y
l.15 ...omma, meta = dE]{EnergyMatrixCromerALD.csv};
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
! Missing = inserted for \ifdim.
<to be read again>
Y
l.15 ...omma, meta = dE]{EnergyMatrixCromerALD.csv};
I was expecting to see `<', `=', or `>'. Didn't.
! Missing number, treated as zero.
<to be read again>
Y
l.15 ...omma, meta = dE]{EnergyMatrixCromerALD.csv};
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
在停止编译之前,对所有数据重复此操作。我不知道它作为一个单元读取的是什么。编译器是 LuaLaTeX,但 pdfLaTeX 中也发生了同样的事情。
如果您能对正在发生的事情提供任何见解,我将不胜感激,无论这是我的数据问题,还是 pgfplots 的问题。
编辑 我从头创建了一个文件,发现问题出在 xmin 选项上。为什么?我不知道。