I'm trying to create a diagram with three x-axes at the bottom. I found a code which creates 3 axes but when I try to plot the data from a csv file I get an error stating:
! Package pgfkeys Error: I do not know the key '/tikz/col sep', to which you passed 'comma', and I am going to ignore it. Perhaps you misspelled it.
I have no problem plotting csv files in other settings but somehow I can't get this to work. What am I doing wrong?
Here is the file:
test.csv
Here is my code:
\begin{document}
\usepackage{pgfplots}
\begin{tikzpicture}
\pgfplotsset{
every axis x label/.style={
at={(ticklabel* cs:1.05)},
yshift = -7.5pt,
anchor=west,},
width=14cm,
height=7cm,
every axis y label/.style={at={(current axis.above origin)},
anchor=north east,
yshift = 1cm,} }
\begin{axis}[
scaled y ticks = false,
y tick label style={/pgf/number format/fixed,
/pgf/number format/1000 sep = \thinspace},
xmin=0,xmax=3,
xlabel={$Re$},
ylabel={$\delta ~\text{[mm]}$},
ymin=0, ymax=2,
ymajorgrids=true, xmajorgrids=true,
axis y line*=left, axis x line*=bottom]
\addplot[color=red,smooth,thick, col sep=comma] {test.csv};
\end{axis}
\begin{axis}[
xmin=0,xmax=70,%--- CF,
hide y axis,
axis x line*=none,
ymin=0, ymax=2,
xlabel={$\dot{V} ~[\text{L} / \text{h}]$},
x label style={yshift=-0.8cm},
x tick label style={yshift=-0.8cm}
]
\addplot[color=blue,smooth,thick] coordinates {
(2.28,1.09068)
(1.67,0.97372)
(1.11,0.832298376)
(0.55,0.634618222)
(0.27,0.46422) };
\end{axis}
\begin{axis}[
xmin=0,xmax=35,
hide y axis,
axis x line*=none,
ymin=0, ymax=2,
xlabel={$\dot{V}/A ~[\text{m}^3 / \text{h} \text{m}^2]$},
x label style={yshift=-1.6cm},
x tick label style={yshift=-1.6cm}
]
\addplot[color=black,thick] coordinates {
(2.28,1.09068)
(1.67,0.97372)
(1.11,0.832298376)
(0.55,0.634618222)
(0.27,0.46422) };
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
This contains an answer to your question, I think, and an MWE. The answer to your question is that you should try
which works if your
test.csv
data has a format in which there is a comma separator. This is becausecol sep=comma
is a valid option for a table, but not for a plot. Notice that I also increasedxmax
for that plot since with your setting the full plot gets clipped away.To make it an MWE, I
amsmath
(since you are using\text
),\usepacage{pgfplots}
above\begin{document}
,test.csv
to the MWE via filecontents to make it easier to test.I did not change any of the details, also because I do not really now what
Re
stands for. If it stands forreal part
, I wouldn't set it in math mode.