Code:
\documentclass[11pt, oneside, a4paper]{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\pgfplotsset{
width=0.8\textwidth,
height=0.5\textwidth,
%compat=newest,
%every axis legend/.append style={at={(0,1.02)},anchor=south west, % Position der Legende in diesem Fall untere linke Ecke bei x=0% und y=100%
%cells={anchor=west}},% Position der Beschriftung innerhalt der Legende (east, center, west)
title style={at={(0.5,1.15)}}% Position der Überschrift
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}
[
scale only axis,
xmin=0, xmax=100,
ymin=0, ymax=30,
axis y line=left,
xlabel=bla\lbrack N\rbrack,
ylabel=blub\lbrack gew. \%\rbrack,
title=\textbf{Notwendige bla über blub},
legend style={at={(0,1.02)},anchor=south west,cells={anchor=west}},
]
\addplot+[color=blue,only marks]
coordinates{
(20,0)
(30,5.62)
(40,6.39)
(50,8.46)
(60,9.64)
(88,24.45)
};
\addplot[mark=,color=blue,domain=1:100]
{0.3282*x-6.599};
\legend{bla,blub (l. Regression)}
\end{axis}
\begin{axis}
[
scale only axis,
xmin=0, xmax=100,
ymin=100, ymax=600,
axis y line=right,
axis x line=none,
ylabel=Schichtdicke \lbrack nm\rbrack,
legend style={at={(1,1.02)},anchor=south east,cells={anchor=west}},
]
\addplot+[color=red, mark=diamond*, only marks]
coordinates{
(20,330)
(30,550)
(40,354)
(50,430)
(60,400)
(80,380)
};
\addplot[mark=,color=red,domain=1:100,style=dashed]
{-0.3808*x+425.61};
\legend{Schichtdicke, Schichtdicke (l. Regression)}
\end{axis}
\end{tikzpicture}
\caption{ein tolles Diagramm mit LaTeX}
\end{figure}
\end{document}
Lesezeichen