# Linear and non-linear functions inside \addplot to get a unique legend

I have functions which have two intervals, a linear and non-linear. I want to have these inside the command \addplot in pgfplots, to get only one legend. I tried it with them in a separated write, but the legend output recognise each one as different function.

Basically, I have two functions to graph, and the legend have to depict that.

I wrote in the preamble: \usepackage{tikz} and \usepackage{pgfplots}.

\begin{figure}[!h]
\centering
\caption{Espectro de pseudo-aceleraciones}
\begin{tikzpicture}[domain=0:5]
\begin{axis}[xlabel={Periodo $T$ (s)},ylabel={$S_a$ ($\times$g)}, xmin=0,xmax=5.5,ymin=0,ymax=2,extra y ticks={.3,1.8}]

\end{axis}

\end{tikzpicture}
\end{figure}

-

You can use forget plot:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}

\begin{document}

\begin{figure}
\centering
\caption{Espectro de pseudo-aceleraciones}
\begin{tikzpicture}[domain=0:5]
\begin{axis}[
xlabel={Periodo $T$ (s)},
ylabel={$S_a$ ($\times$g)},
xmin=0,
xmax=5.5,
ymin=0,
ymax=2,
extra y ticks={.3,1.8}
]

\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}


-

It sounds like you need the forget plot option, as detailed in pgfplots: prevent single plot from being listed in legend

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[domain=0:5]
\begin{axis}[xlabel={Periodo $T$ (s)},ylabel={$S_a$ ($\times$g)}, xmin=0,xmax=5.5,ymin=0,ymax=2,extra y ticks={.3,1.8}]