减少列之间的水平空间

减少列之间的水平空间

我正在使用 groupplot 生成以下图表:

在此处输入图片描述

关于右图:如果列之间的间距减小,那么图表会更美观。目前,列与图表的边框重叠,并且列之间有足够的空间。

问题:如何减少右图中分组列之间的水平空间?

代码:参见背页或参见下面的代码:

\documentclass{article}
        \usepackage[utf8]{inputenc}
        \usepackage{pdflscape}
        \usepackage[table]{xcolor}
        \usepackage[landscape, a4paper, bottom=0cm, margin=0in, top=2cm]{geometry}
        \usepackage{pgfplots}

        \pagenumbering{gobble}
        \definecolor{customgreen}{RGB}{118,189,34}
        \definecolor{custompink}{RGB}{0,78,89}
        \definecolor{customlightblue}{RGB}{207,210,235}
        \definecolor{customlighterblue}{RGB}{232,234,245}
        \definecolor{custombrown}{RGB}{200,208,213}
        \usepgfplotslibrary{
          units, % Allows to enter the units nicely
          groupplots
        }

        \title{test}


        \begin{document}
        %\maketitle

        \hspace{2cm}{\Huge \color{customgreen} Medicin}
                            \pgfplotstableread[row sep=\\,col sep=&]{
                                interval                    & a                             & b     \\
                                SABA                        & 85.00        & 64.20  \\
                                LABA                        & 65.00        & 8.20  \\
                                LAMA                        & 50.00        & 44.00  \\
                                LABA/LAMA                   & 0.00   & 13.30  \\
                                ICS                         & 75.00         & 24.30  \\
                                LABA/ICS                    & 30.00    & 76.70  \\
                                Systemisk glukokortikoid    & 0.00       & 3.30  \\
                                Fosfodiesterasehæmmer       & 0.00       & 0.30  \\
                                Methylxantin                & 0.00        & 0.40  \\
                                Hjemmeilt                   & 5.00   & 3.50  \\
                                }\mydata

                                \pgfplotstableread[row sep=\\,col sep=&]{
                                interval                    & a                             & b     \\
                                LABA                        & 95.00        & 98.20  \\
                                LAMA                        & 50.00        & 57.30  \\
                                ISC                        & 105.00        & 101.00  \\
                                }\dobbetdata

                            \begin{figure}[h]
                            \vspace*{1.8cm}
                            \centering
                            \begin{tikzpicture}
                                \begin{groupplot}[
                                        group style={group size=2 by 1, horizontal sep=2cm},
                                        legend style={at={(0.5,1)}, text width=6em, text height=1.5ex, anchor=north,legend columns=-1},
                                        ybar,
                                        /tikz/bar width=.55cm,
                                        xtick=data,
                                        ymin=0, %ymax=130,
                                        ,height=10cm,
                                        nodes near coords,
                                        every node near coord/.append style={color=black, font=\footnotesize}
                                    ]

                            \nextgroupplot[
                               title=\textbf{Medicinering},
                               width=.65\textwidth,
                               xticklabel style={rotate=35, anchor=north east},
                               symbolic x coords={SABA,LABA,LAMA,LABA/LAMA,ICS,LABA/ICS,Systemisk glukokortikoid,Fosfodiesterasehæmmer,Methylxantin,Hjemmeilt},
                               ymax=100,
                               y label style={at={(axis description cs:-0.05,.5)},anchor=south},
                               ylabel={Procent}
                            ]
                                    \addplot[red!50!customgreen,fill=customgreen!50!white] table[x=interval,y=a]{\mydata};
                                    \addplot[red!20!custompink,fill=custompink!80!white] table[x=interval,y=b]{\mydata};
                                    \legend{Klinik 30507, Landsdata}


                            \nextgroupplot[
                               title=\textbf{Dobbelt medicinering},
                               width=.30\textwidth,
                               xticklabel style={rotate=35, anchor=north east},
                               symbolic x coords={LABA,LAMA,ISC},
                               ymax=140,
                               y label style={at={(axis description cs:-0.15,.5)},anchor=south},
                               ylabel={Procent}
                            ]
                                    \addplot[red!20!customgreen,fill=customgreen!80!white] table[x=interval,y=a]{\dobbetdata};
                                    \addplot[red!20!custompink,fill=custompink!80!white] table[x=interval,y=b]{\dobbetdata};
                                    \legend{Klinik 30507, Landsdata}

                            \end{groupplot}
                            \end{tikzpicture}
                            \end{figure}



        \end{document}

相关内容