我目前遇到一个问题,即 y 轴的标签不符合我的预期。目前标签从 10 开始,在 1000 后换行。有没有办法让标签从 1 开始,在 100 后换行?
有人能概述一下我的错误在哪里吗?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{siunitx}
\usepackage{tikz,pgfplots}
\begin{filecontents*}{gmm.csv}
x,manual_time,manual_memory,manual_error,impala_time,impala_memory,impala_error,impala-fix_time,impala-fix_memory,impala-fix_error,enzyme_time,enzyme_memory,enzyme_error,torch_time,torch_memory,torch_error
30,1,1409856,0.0,1,7570368,1.328272944021411e-14,1,8537088,1.328272944021411e-14,1,5080000,1.2354678474958976e-14,130,177531328,2.899777806651742e-15
60,2,1540928,0.0,3,8176576,1.8776855000741528e-13,2,9192448,1.8776855000741528e-13,2,9323392,1.8776855000741528e-13,129,179411328,4.2111715245608495e-14
150,5,1442688,0.0,7,17957952,4.2045319174289427e-13,8,16827584,4.2045319174289427e-13,7,19481536,4.2905581459185374e-13,140,283552896,7.640119609800198e-14
300,11,1377088,0.0,14,34014144,2.8436042738716444e-13,15,31147072,2.8436042738716444e-13,14,37307328,2.8436042738716444e-13,161,452968960,1.084077968323424e-13
330,7,1983296,0.0,6,33588608,2.5882150950782227e-14,7,15844416,2.5882150950782227e-14,5,16368768,2.417010205520519e-14,135,238619392,1.8731886315043515e-14
660,13,2147200,0.0,13,62964672,2.2418498542542217e-13,12,27968512,2.2418498542542217e-13,11,25051968,2.2418498542542217e-13,145,361078592,8.260059303211165e-14
1155,17,3031936,0.0,21,103482432,1.497925084279553e-14,15,28673088,1.8003881722357218e-14,14,25412608,5.997543098760249e-14,144,288566400,5.367407238477746e-14
1200,44,1426240,0.0,55,131531904,3.9152014963406145e-13,56,115524736,3.9152014963406145e-13,55,145392768,4.0131786782637846e-13,257,546071680,7.974036694338897e-14
1650,34,2179968,0.0,34,154420416,3.63555831004538e-13,31,64340928,3.63555831004538e-13,26,60130304,3.837241477269316e-13,174,395219072,2.708944180085382e-14
2310,33,2966400,0.0,38,204014976,1.3722609993754605e-13,27,51889088,1.3722609993754605e-13,26,46875712,2.487454686672663e-13,160,346017472,5.808686864838819e-13
2805,32,4080512,0.0,45,241403392,2.9441807806984166e-14,24,42959936,4.32650956187999e-14,29,38290368,6.002139383402994e-13,156,309341440,2.293575453007941e-13
3300,68,2261888,0.0,66,306890240,3.7735476481537635e-13,63,126829888,3.7735476481537635e-13,55,118179008,4.0594072192595703e-13,234,598779520,1.219024881038422e-13
5610,67,3949440,0.0,95,478693312,7.66053886991358e-14,50,81740800,7.66053886991358e-14,61,71107712,5.805356195764944e-13,200,418869376,7.482903185973555e-13
5775,86,3376256,0.0,104,505645120,6.141915426417256e-14,71,125486336,6.141915426417256e-14,70,110904320,1.8181019008615925e-13,236,568370688,8.657579878064937e-13
10725,122,7193728,0.0,206,890817216,1.4493080668625627e-13,69,83985472,1.155742168634788e-13,78,72221760,1.595559233604187e-12,219,440652224,6.6275873678023345e-12
11550,183,3621952,0.0,231,1008159488,1.5242747564090773e-13,146,247793024,1.5242747564090773e-13,148,219104576,2.5512925105886097e-13,363,985100736,2.3581137043038325e-13
13200,288,3032192,0.0,291,1221020928,3.469290385312999e-13,255,500582336,3.469290385312999e-13,229,466454400,3.469290385312999e-13,573,1735125120,6.536993168992922e-13
14025,178,4686912,0.0,266,1190906880,6.578071420904053e-14,134,198526208,6.017408793468348e-14,165,172180736,1.0480477276455908e-12,331,771742528,7.562284132234254e-13
21450,237,7718016,0.0,450,1774883008,2.3973897879405337e-13,145,161416448,2.3973897879405337e-13,161,137987392,4.522104912751956e-12,329,673019904,5.005440506522518e-12
28050,351,5276736,0.0,526,2377962816,2.0602963779481342e-13,267,393168512,2.0602963779481342e-13,331,340510400,1.5625001292818297e-12,536,1421381440,1.0385581283856027e-12
46200,717,5440640,0.0,919,4023656768,1.7456302770060798e-13,572,982174400,1.7456302770060798e-13,586,868043328,2.065001965601052e-13,1164,3256829376,2.1671553440683056e-13
53625,603,8733760,0.0,1037,4427867392,1.3610126132002599e-12,356,393889536,1.3610126132002599e-12,397,335332800,3.082756272476672e-12,655,1417060032,3.69435487132549e-12
107250,1190,11928704,0.0,2115,8849081792,1.602929398391429e-13,714,781126080,1.602929398391429e-13,789,664504704,6.146194664324867e-12,1263,2649629568,1.0741962874760702e-11
112200,1418,8881344,0.0,2162,9500412480,1.9285668241123054e-13,1072,1560629184,1.9285668241123054e-13,1329,1350389184,7.853717676198357e-13,2008,5013442560,1.2035715503887456e-12
429000,4927,16679744,0.0,21572,35376827136,7.673861546209082e-13,2943,3105610624,4.121147867408581e-13,3305,2638632640,1.0660750060509372e-11,8276,9604215872,1.01527120044409e-11
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmode=log,
ymode=log,
width=\textwidth,
height=0.5\textwidth,
legend style={at={(0,1)},xshift=0.2cm, yshift=-0.2cm,anchor=north west,nodes=right},
xlabel={Parameters},
ylabel={Memory},
yticklabel={\SI[round-mode=figures,exponent-to-prefix=true,scientific-notation=engineering,zero-decimal-to-integer=true]{\fpeval{exp(\tick)}}{\byte}},
log y ticks with fixed point/.style={
yticklabel={
\pgfkeys{/pgf/fpu=true}
\pgfmathparse{exp(\tick)}%
\pgfmathprintnumber[fixed relative, precision=3]{\pgfmathresult}
\pgfkeys{/pgf/fpu=false}
}
}
]
\addplot+[mark options={scale=0.5}] table [x expr=\thisrow{x}, y expr=\thisrow{enzyme_memory}, col sep=comma] {gmm.csv};
\addplot+[mark options={scale=0.5}] table [x expr=\thisrow{x}, y expr=\thisrow{torch_memory}, col sep=comma] {gmm.csv};
\addplot+[mark options={scale=0.5}] table [x expr=\thisrow{x}, y expr=\thisrow{impala_memory}, col sep=comma] {gmm.csv};
\addplot+[mark options={scale=0.5}, style={gray, densely dashed}] table [x expr=\thisrow{x}, y expr=\thisrow{manual_memory}, col sep=comma] {gmm.csv};
\addlegendentry{Enzyme}
\addlegendentry{PyTorch}
\addlegendentry{Thorin AD}
\addlegendentry{Manual}
\end{axis}
\end{tikzpicture}
\end{document}