Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
Thanks for your answer, @Gonzalo ! –  Paul Paulsen Apr 28 at 16:59
    
@Paul You're welcome! –  Gonzalo Medina Apr 28 at 20:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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