在多次阅读 Stack OverFlow 以解决我的问题后,我今天在论坛上问我的第一个问题!:) 我正在使用以下代码用 Tikz 绘制曲线。
如果我通常使用例如此代码添加坐标,则效果很好。
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+ [mark=none] coordinates {(0,2.6) (1,2.5) (2,2.6)};
\end{axis}
\end{tikzpicture}
\end{document}
但是,如果我想使用 txt 文件中的数据,则不会出现错误消息,但曲线不会绘制在图表上(我的 txt 文件只是由空格分隔的 3 列数据)这就是这段代码发生的情况:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+ [mark=none] table[x index=0,y index=1]{Data/vitessewood.txt};
\end{axis}
\end{tikzpicture}
\end{document}
通过删除“[mark=none]”,曲线出现在带有此代码的图形上。它证明代码能够读取 txt 文件,问题就像从 txt 文件导入数据和使用选项 [mark=none] 绘制数据之间的不兼容。
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+ table[x index=0,y index=1]{Data/vitessewood.txt};
\end{axis}
\end{tikzpicture}
\end{document}
我已经尝试过使用“addplot+”或只使用“addplot”。我已经尝试增加厚度以确保厚度参数不为零。
如果您有任何解决问题的想法,请随时告诉我。我的预期结果只是能够绘制没有标记的数据。
非常感谢 !:)