1

I have three columns of data and one which stops at a moment, but the other continues. But LaTeX creates the values as a constant, and I don't want them to appear, how to do?

\begin{figure}[h!]
        \centering
                \begin{tikzpicture}[scale=0.5]
      \pgfplotsset{compat=1.12,width=1.\linewidth}
\begin{axis}[minor tick num=4,xlabel=Applied magnetic field $H(T)$,ylabel=Critical current value $I_c(A)$]
\addplot+[blue,mark=diamond] table [blue,mark=diamond,x=H, y=Ie]{IcH.csv};
\addplot+[red,mark=diamond] table [red,mark=diamond,x=H, y=It,domain=0:3.6]{IcH.csv};
\end{axis}
\end{tikzpicture}
        \caption{Curves of blabla.}
    \end{figure}

enter image description here

0

1 Answer 1

3

I do not have your data, so I just made up some numbers which is nowhere near what you have, but it illustrates the point.

This answers is stolen from Dr. Manuel Kuehner's pgfplots, plot options ignored when using “restrict expr to domain”.

Output enter image description here

Code

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}
\begin{filecontents*}{dataa.csv}
H,Ie,c,It
1,4,5,1
2,3,1,5
3,5,6,1
4,1,4,9
5,3,4,7
\end{filecontents*}


\begin{document}
\begin{tikzpicture}
[scale=0.5]
      \pgfplotsset{compat=1.12,width=1.\linewidth%
      }
\begin{axis}[minor tick num=4,xlabel=Applied magnetic field $H(T)$,ylabel=Critical current value $I_c(A)$]
\addplot+[blue,mark=diamond] table [blue,mark=diamond,x=H, y=Ie,col sep=comma]{dataa.csv};
\addplot+[red,mark=diamond,
        restrict expr to domain={\thisrow{H}}{0:3}, 
        unbounded coords=discard,
        ]table [red,mark=diamond,x=H, y=It,,col sep=comma]{dataa.csv};
\end{axis}
\end{tikzpicture}

\end{document}

Not the answer you're looking for? Browse other questions tagged .