如何去除用 CSV 檔案製作的圖形的標記

如何去除用 CSV 檔案製作的圖形的標記

我正在導入 CSV 文件,並且想要去掉圖形的標記,我該怎麼做?

\documentclass{minimal}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

%\usepackage{filecontents}% Commented out dataCL.csv is not overwriten.
\begin{filecontents*}{dataCL.csv}
    x, y
    1, 10
    2, 15
    3, 17
\end{filecontents*}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot table [mark = none, draw = none,col sep=comma,x=x, y=y] {dataCL.csv};
\end{axis}
asdfasdfasdfasd
\end{tikzpicture}
\end{document}

答案1

mark=none\addplot是/的選項\addplot+,而不是table.順便說一句,你應該使用only marks而不是draw=none.請參閱隨附的範例,其中第一個圖只有一條線,第二個圖只有標記。

\documentclass{article}
\usepackage{pgfplots}

\usepackage{filecontents}% Commented out dataCL.csv is not overwriten.
\begin{filecontents*}{dataCL.csv}
    x, y
    1, 10
    2, 15
    3, 17
\end{filecontents*}

\begin{document}
\begin{tikzpicture}
\begin{axis}
    \addplot+ [mark=none] table [col sep=comma, x=x, y=y] {dataCL.csv};
    \addplot+ [only marks] table [col sep=comma, x=x, y=y] {dataCL.csv};
\end{axis}
\end{tikzpicture}
\end{document}

相關內容