使用 matlab2tikz 时重叠刻度和图形未居中

使用 matlab2tikz 时重叠刻度和图形未居中

参见截图。我想要的是图形居中,但使用 后却无法实现\setlength\figurewidth{1.0\textwidth}。此外,x 轴上带有负号的刻度重叠了。我该如何解决这些问题?谢谢 :)

现在的样子:

在此处输入图片描述

代码

\begin{tikzpicture}

\begin{axis}[%
width=\figurewidth,
height=\figureheight,
%scale only axis, % Commented out as suggested in the answer
xmin=-2000,
xmax=500,
ymin=-1000,
ymax=400,
xtick={-1600,-1200,-800,-400,0,400}, % Now added to solve
ytick={-800,-400,0,400} % Now added
]
\addplot [color=red,solid,forget plot]
  table[row sep=crcr]{%
0   0\\
0.198854299827786   -3.4314342957753e-05\\
0.390189269262637   0.000572951530544596\\
0.580159224048429   0.00169575075199724\\
0.776528090033777   0.00282710506604467\\
0.984098727468267   0.00371200672468541\\

答案1

默认情况下,matlab2tikzscale only axis生成启用轴环境选项的代码(参见4.10.1 常见的缩放选项pgfplots 文档)。只需从 .tikz 文件中删除该行即可解决第一个问题。第二个问题更多是关于您对数据的个人表示,因此我可能只建议减小字体或更改单位。希望这会有所帮助。

相关内容