5

I want to do a group of plots. However, I set the option \tikzset{every picture/.style={framed} at the begin of my document, because I want a frame around all my pictures. What I get now is a frame around the figure AND each subplot - which I don´t want. How can I prevent this?


MWE:

\documentclass{standalone}

\usepackage{pgfplots}
\usetikzlibrary{backgrounds,pgfplots.groupplots}

\tikzset{every picture/.style={framed,background rectangle/.style={draw=black!80,rounded corners=.5ex}}}

\begin{document}

\begin{tikzpicture}

\begin{groupplot}[group style={group size=2 by 2},
height=6cm, width=8cm,
xlabel=$\vartheta$,
hide y axis,
axis x line=middle,
xmin=-1, xmax=361,
every axis xlabel/.style={
at={(0,0)},anchor=center},
samples=200,
xtick={0,60, 120, 180, 240, 300, 360}]
\nextgroupplot[title={$m=0$}]
\addplot+[domain=0:360,mark=none]{0*x};
\nextgroupplot[title={$m=1$}]
\addplot+[domain=0:360,mark=none]{sin(x)};
\nextgroupplot[title={$m=2$}]
\addplot+[domain=0:360,mark=none]{sin(2*x)};
\nextgroupplot[title={$m=3$}]
\addplot+[domain=0:360,mark=none]{sin(3*x)};
\end{groupplot}   

\end{tikzpicture}

\end{document}

Example (doesn´t look the as the MWE due to strange spacing in my document, but that shouldn´t bother): example of unwanted behaviour

Sorry if this question has already been asked or if there is an obvious answer - I couldn´t find anything.

4

You can pass the option /tikz/background rectangle/.style={draw=none} to groupplot (the prefix is required since those are TikZ keys):

\documentclass{standalone}

\usepackage{pgfplots}
\usetikzlibrary{backgrounds,pgfplots.groupplots}

\tikzset{
every picture/.style={
  framed,
  background rectangle/.style={
    draw=black!80,
    rounded corners=.5ex
    }
  }
}

\begin{document}

\begin{tikzpicture}

\begin{groupplot}[group style={group size=2 by 2},/tikz/background rectangle/.style={draw=none},
height=6cm, width=8cm,
xlabel=$\vartheta$,
hide y axis,
axis x line=middle,
xmin=-1, xmax=361,
every axis xlabel/.style={
at={(0,0)},anchor=center},
samples=200,
xtick={0,60, 120, 180, 240, 300, 360}]
\nextgroupplot[title={$m=0$}]
\addplot+[domain=0:360,mark=none]{0*x};
\nextgroupplot[title={$m=1$}]
\addplot+[domain=0:360,mark=none]{sin(x)};
\nextgroupplot[title={$m=2$}]
\addplot+[domain=0:360,mark=none]{sin(2*x)};
\nextgroupplot[title={$m=3$}]
\addplot+[domain=0:360,mark=none]{sin(3*x)};
\end{groupplot}   
\end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.