0

This post is building from the post found here. How do I go about changing the y-limits of all the right hand side plots to a ymin of -160?

Here is my code:

\documentclass[11pt]{book}
\usepackage[%
    ,top=3cm
    ,bottom=3cm
    ,left=3.2cm
    ,right=3.2cm
    ,headsep=10pt
    ,a4paper
    ]{geometry}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{%
    ,compat=1.12
    ,minor grid style={dashed,gray!30}
    ,major grid style={dotted,green!50!black}
    }
\usepackage{caption,subcaption}
\captionsetup[subfigure]{labelfont=it,textfont=it,labelformat=parens,labelsep=space}
\usepackage{siunitx}

\begin{filecontents*}{d1.csv}
  Freq   Orig     LP LP-filt     HP HP-filt  De-Em De-Em-filt
100.0000000, -79.3740000, 1.0000000, -79.3740000, 0.0121951, -117.6502770, 0.8182771, -81.1159920
545.0470000, -85.6780000, 1.0000000, -85.6780003, 0.9159352, -86.4407046, 0.1316228, -103.2913751
100000.0000000, -136.5700000, 0.0000000, -441.1457491, 1.0000000, -136.5700000, 0.0000045, -243.5002239
101800.9750000, -139.0040000, 0.0000000, -445.1301366, 1.0000000, -139.0040000, 0.0000043, -246.2443001
\end{filecontents*}

\begin{document}
\listoffigures
\lipsum[1]
\begin{figure}[h]
    \centering
    \begin{tikzpicture}
        \setcaptionsubtype
        \begin{groupplot}[%
            ,group style={%
                ,group name=my plots
                ,group size=2 by 3
                ,vertical sep=2cm,
                ,horizontal sep = 2cm,
                ,ylabels at=edge left
                },
            xmode = log,
            xmin = 100,
            xmax = 100000,
            width=7cm,
            height=6cm,
            try min ticks=5,
            xlabel={Frequency in \si{\hertz}},
            grid=both,
            every major grid/.style={gray, opacity=0.5}
            ]
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=2,col sep=comma] {d1.csv};
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=3,col sep=comma] {d1.csv};
\end{groupplot}
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r1.north) {\caption{Plot \arabic{subfigure}\label{subplot:one}}};
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r1.north) {\caption{Plot \arabic{subfigure}\label{subplot:two}}};
\end{tikzpicture}
\caption{Plot showing Absolute Errors.}
\end{figure}
\begin{figure}
\ContinuedFloat
\centering
\begin{tikzpicture}
\setcaptionsubtype
\begin{groupplot}[%
            ,group style={%
                ,group name=my plots
                ,group size=2 by 3
                ,vertical sep=2cm,
                ,horizontal sep = 2cm,
                ,ylabels at=edge left
            },
            xmode = log,
            xmin = 100,
            xmax = 100000,
            width=7cm,
            height=6cm,
            try min ticks=5,
            xlabel={Frequency in \si{\hertz}},
            grid=both,
            every major grid/.style={gray, opacity=0.5}
            ]
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=4,col sep=comma] {d1.csv};
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=5,col sep=comma] {d1.csv};
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=6,col sep=comma] {d1.csv};
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=7,col sep=comma] {d1.csv};
        \end{groupplot}
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r1.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:three}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r1.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:four}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r2.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:five}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r2.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:six}}};
\end{tikzpicture}
\caption[]{Plot showing Absolute Errors. (continued)}\label{abserror}
\end{figure}
\end{document}
3
  • Use the key ymin=-160 in the axis options, right where xmin is used? Does that not work for some reason?
    – darthbith
    Commented Jan 4, 2016 at 18:11
  • that changes the ymin on all the plots. I just want the plots on the right to have this ymin change. Thanks.
    – Joe
    Commented Jan 4, 2016 at 18:13
  • 1
    So plots 2, 4, and 6? Just put it in the nextgroupplot options for those particular, like \nextgroupplot[ymin=-160]. Does that work?
    – darthbith
    Commented Jan 4, 2016 at 18:16

1 Answer 1

2

Simply add the option [ymin=-160] to the \nextgroupplot command for the appropriate graphs:

\documentclass[11pt]{book}
\usepackage[%
    ,top=3cm
    ,bottom=3cm
    ,left=3.2cm
    ,right=3.2cm
    ,headsep=10pt
    ,a4paper
    ]{geometry}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{%
    ,compat=1.12
    ,minor grid style={dashed,gray!30}
    ,major grid style={dotted,green!50!black}
    }
\usepackage{caption,subcaption}
\captionsetup[subfigure]{labelfont=it,textfont=it,labelformat=parens,labelsep=space}
\usepackage{siunitx}

\begin{filecontents*}{d1.csv}
  Freq   Orig     LP LP-filt     HP HP-filt  De-Em De-Em-filt
100.0000000, -79.3740000, 1.0000000, -79.3740000, 0.0121951, -117.6502770, 0.8182771, -81.1159920
545.0470000, -85.6780000, 1.0000000, -85.6780003, 0.9159352, -86.4407046, 0.1316228, -103.2913751
100000.0000000, -136.5700000, 0.0000000, -441.1457491, 1.0000000, -136.5700000, 0.0000045, -243.5002239
101800.9750000, -139.0040000, 0.0000000, -445.1301366, 1.0000000, -139.0040000, 0.0000043, -246.2443001
\end{filecontents*}

\begin{document}
\listoffigures
\lipsum[1]
\begin{figure}[h]
    \centering
    \begin{tikzpicture}
        \setcaptionsubtype
        \begin{groupplot}[%
            ,group style={%
                ,group name=my plots
                ,group size=2 by 3
                ,vertical sep=2cm,
                ,horizontal sep = 2cm,
                ,ylabels at=edge left
                },
            xmode = log,
            xmin = 100,
            xmax = 100000,
            width=7cm,
            height=6cm,
            try min ticks=5,
            xlabel={Frequency in \si{\hertz}},
            grid=both,
            every major grid/.style={gray, opacity=0.5}
            ]
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=2,col sep=comma] {d1.csv};
\nextgroupplot[ymin=-160]%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=3,col sep=comma] {d1.csv};
\end{groupplot}
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r1.north) {\caption{Plot \arabic{subfigure}\label{subplot:one}}};
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r1.north) {\caption{Plot \arabic{subfigure}\label{subplot:two}}};
\end{tikzpicture}
\caption{Plot showing Absolute Errors.}
\end{figure}
\begin{figure}
\ContinuedFloat
\centering
\begin{tikzpicture}
\setcaptionsubtype
\begin{groupplot}[%
            ,group style={%
                ,group name=my plots
                ,group size=2 by 3
                ,vertical sep=2cm,
                ,horizontal sep = 2cm,
                ,ylabels at=edge left
            },
            xmode = log,
            xmin = 100,
            xmax = 100000,
            width=7cm,
            height=6cm,
            try min ticks=5,
            xlabel={Frequency in \si{\hertz}},
            grid=both,
            every major grid/.style={gray, opacity=0.5}
            ]
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=4,col sep=comma] {d1.csv};
\nextgroupplot[ymin=-160]%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=5,col sep=comma] {d1.csv};
\nextgroupplot%
\addplot [smooth,blue]table[x index=0,y index=6,col sep=comma] {d1.csv};
\nextgroupplot[ymin=-160]%
\addplot [smooth,blue]table[x index=0,y index=1,col sep=comma] {d1.csv};
\addplot [smooth,red]table[x index=0,y index=7,col sep=comma] {d1.csv};
        \end{groupplot}
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r1.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:three}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r1.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:four}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r2.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:five}}};
        \node[text width=.5\linewidth,align=center,anchor=south] at (my plots c2r2.north) {\caption[]{Plot \arabic{subfigure}\label{subplot:six}}};
\end{tikzpicture}
\caption[]{Plot showing Absolute Errors. (continued)}\label{abserror}
\end{figure}
\end{document}

Showing the second set of plots: enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .