Seite 1 von 1

weißer Hintergrund im Textfeld Diagramm

Verfasst: Fr 3. Feb 2017, 16:28
von Vaschan
Hallo zusammen,

ist es möglich, den Text mit einem weißen Hintergrund zu hinterlegen, sodass die Gitterlinien nicht stören?

\documentclass[12pt,titlepage,a4paper]{report} 

\usepackage[pdftex]{graphicx} 
\usepackage{pgfplots}

\begin{document} 

 \begin{figure}[tbh] 
\begin{tikzpicture}
\begin{axis}[legend style={at={(0.5,1)},anchor=south , legend columns = 3}, ymajorgrids,xmajorgrids]
\addplot coordinates {(0,0) (1,1)};
\addplot coordinates {(0,1) (1,2)};
\addplot coordinates {(0,2) (1,3)};
\node[black,above] at (axis cs: 0.5,1){{\Large  testtext}};
\legend{c=1.5 ,b=1.6, a=1.4}
\end{axis}
\end{tikzpicture}
\end{figure}  
\end{document}

Verfasst: Fr 3. Feb 2017, 16:45
von Gast
Das geht ganz einfach mit Option fill=white für den entsprechenden node:
\documentclass[12pt,titlepage,a4paper]{report}

\usepackage{graphicx}% pdftex als Option grundsätzlich weglassen!
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% Laut Anleitung immer anzugeben!

\begin{document}

\begin{figure}[tbh]
\begin{tikzpicture}
\begin{axis}[legend style={at={(0.5,1)},anchor=south , legend columns = 3}, ymajorgrids,xmajorgrids]
\addplot coordinates {(0,0) (1,1)};
\addplot coordinates {(0,1) (1,2)};
\addplot coordinates {(0,2) (1,3)};
\node[black,fill=white,above] at (axis cs: 0.5,1){{\Large testtext}};
\legend{c=1.5 ,b=1.6, a=1.4}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
Beachte unbedingt auch die zusätzlichen Änderungen in meinem Code!

Verfasst: Fr 3. Feb 2017, 18:13
von Vaschan
Vielen Dank :) auch für die anderen Tipps