I have a .csv
with 2-dimensional data. Now I am trying to plot it in different index ranging from -n:1:n
(this index is y-axis
).
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepackage{pgfplotstable}
\begin{document}
\begin{tikzpicture}
\pgfplotstableread{
T3,v11
0,0.66582
0.000125,0.66582
0.00025,0.66582
0.000375,0.66582
0.0005,0.66582
0.000625,0.66582
0.00075,0.66582
0.000875,0.66582
0.001,0.66582
0.001125,0.66582
}\dummydata
\begin{axis}[
domain=-4:4,
samples y=0, ytick={1,...,4},
]
{
\addplot3 table [x =T3, y expr=1, z=v11, col sep = comma]
{\dummydata};
}
\end{axis}
\end{tikzpicture}
\end{document}
This throws errors like:
! Package pgfplots Error: The requested list entry with index 1 of \dummydata i s too large; this list has not enough elements..
See the pgfplots package documentation for explanation. Type H for immediate help. ...
l.27 {\dummydata}; This error message was generated by an \errmessage command, so I can't give any explicit help. Pretend that
you're Hercule Poirot: Examine all clues, and deduce the truth by order and method.
! Package pgfplots Error: Sorry, could not retrieve column 'T3' from table ''. Please check spelling (or introduce name aliases)..
See the pgfplots package documentation for explanation. Type H for immediate help. ...
l.27 {\dummydata}; (That was another \errmessage.)
! Package pgfplots Error: Sorry, could not retrieve column 'v11' from table ''. Please check spelling (or introduce name aliases)..
See the pgfplots package documentation for explanation. Type H for immediate help. ...
l.27 {\dummydata}; (That was another \errmessage.)
Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away) on input line 27.
[warning /pgfplots/warning/plot without coordinates]
Package pgfplots Warning: You have an axis with empty range (in direction z). R eplacing it with a default range and clearing all plots. on input line 29.
[warning /pgfplots/warning/empty range cleared axis] LaTeX Font Info: External font
cmex10' loaded for size (Font) <7> on input line 29. LaTeX Font Info: External font
cmex10' loaded for size (Font) <5> on input line 29.
However, instead of using a .csv
format, if I stick with a table format (that is removing a comma between the data and also col sep = comma
in the plot, then I get what I desired. However, the data I have is in .csv
format (pretty big). So, instead of creating a huge data-set for y-axis
, how can I achieve it with the above-mentioned script.
The one that works without a .csv
format (and without creating a huge data-set for a different axis per-se):
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepackage{pgfplotstable}
\begin{document}
\begin{tikzpicture}
\pgfplotstableread{
T3 v11
0 0.66582
0.000125 0.66582
0.00025 0.66582
0.000375 0.66582
0.0005 0.66582
0.000625 0.66582
0.00075 0.66582
0.000875 0.66582
0.001 0.66582
0.001125 0.66582
}\dummydata
\begin{axis}[
domain=-4:4,
samples y=0, ytick={1,...,4},
]
{
\addplot3 table [x =T3, y expr=1, z=v11]
{\dummydata};
}
\end{axis}
\end{tikzpicture}
\end{document}
which would give me the desired output:
PS: This is just an example, in reality I use the external file to import my data for plotting purposes.