0

I have seen this, but writing \addplot+ did not fix the issue. I don't know how to (or if I can) apply this question to my graph as the question is plotting only marks.

I have the following code:

\begin{filecontents*}{abc.csv}
a, b
1,2
3,4
5,6
\end{filecontents*}

\documentclass{article} \usepackage{pgfplots} \begin{document}

\begin{tikzpicture} \begin{axis}[no markers, table/col sep=comma,] \addplot+ table[green, dashed, x=a,y=b,] {abc.csv}; \addplot [red, dashed] {x^2}; \end{axis} \end{tikzpicture}

\end{document}

Whether I write \addplot+ or just \addplot, the output is the same.

When compiled, the x^2 graph comes out red and dashed, but the abc graph does not come with the options added. It remains solid blue.

[Screenshot of Graph 1

I got the warning Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.18} into your preamble., but adding \pgfplotsset{compat=1.18} to the preamble did not change the output.

How can I change the style of the plot with data from a csv?

1 Answers1

0
\begin{filecontents*}{abc.csv}
a,b
1,2
3,4
5,6
\end{filecontents*}
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
no markers,
table/col sep=comma,
]
\addplot[teal, dashed] table[x=a, y=b] {abc.csv}; 
\addplot[red, dashed] {x^2}; 
\end{axis}
\end{tikzpicture}
\end{document}

Graph with dashed parabola and line