hi,
man kann auch lokal einstellungen vornehmen
Code:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
%\pgfplotsset{
%/pgfplots/legend image code/.code={%
%\draw[#1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);
%}}
\pgfkeys{/pgf/number format/.cd,fixed,precision=4}
\begin{tikzpicture}
\begin{axis}[
legend image code/.code={%
\draw[#1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);}
width=10cm,
xlabel=Fin,
xtick={0,...,4},
xticklabels={A,B,C,D,E,F},
ytick={0.000,0.020,0.040,0.060,0.080,0.100,0.120,0.140},
ylabel=Standardabweichung \lbrack mm\rbrack,
ymin=0.0,
ymax=0.140,
ymajorgrids,
extra description/.code={
\node at (0.5,0.5) {Center!};}
]
\usetikzlibrary{patterns}
\addplot[ybar,draw=black,pattern=north east lines] plot coordinates
{(0,0.062) (1,0.053) (2,0.053)};
\addlegendentry{Bereich A}
\addplot[ybar,fill=green] plot coordinates
{(3,0.116) (4,0.097)};
\addlegendentry{Bereich B}
\addplot[red, mark=none] coordinates
{(0,0.062)(3,0.062)};
\addlegendentry{OTG}
\end{axis}
\end{tikzpicture}
\end{document}
mit extra description und mit hilfe einer tikz matrix könntest du auch die legende "einfach" nachbauen. allerdings hab ich es mit der paltzierung noch nicht raus. mal die mailing liste fragen...
Code:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{patterns}
\begin{document}
%\pgfplotsset{
%/pgfplots/legend image code/.code={%
%\draw[#1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);
%}}
\pgfkeys{/pgf/number format/.cd,fixed,precision=4}
\begin{tikzpicture}
\begin{axis}[
legend image code/.code={%
\draw[#1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);}
width=10cm,
xlabel=Fin,
xtick={0,...,4},
xticklabels={A,B,C,D,E,F},
ytick={0.000,0.020,0.040,0.060,0.080,0.100,0.120,0.140},
ylabel=Standardabweichung \lbrack mm\rbrack,
ymin=0.0,
ymax=0.140,
ymajorgrids,
]
\addplot[ybar,draw=black,pattern=north east lines] plot coordinates
{(0,0.062) (1,0.053) (2,0.053)};
%\addlegendentry{Bereich A}
\addplot[ybar,fill=green] plot coordinates
{(3,0.116) (4,0.097)};
%\addlegendentry{Bereich B}
\addplot[red, mark=none] coordinates
{(0,0.062)(3,0.062)};
%\addlegendentry{OTG}
\end{axis}
\end{tikzpicture}
%Legend as it should be
\begin{tikzpicture}%
\matrix[draw]{%
\draw[draw=black,pattern=north east lines] (0cm,-0.1cm) rectangle (0.6cm,0.1cm); & \node{legend 1};\\
\draw[draw=black,fill=green] (0cm,-0.1cm) rectangle (0.6cm,0.1cm); & \node{legend 2};\\%
\draw[red, line width=1pt] (0cm,0cm) -- (0.6cm,0cm); & \node{legend 3};\\};
\end{tikzpicture}
\end{document}
Lesezeichen