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'm facing some problems at the moment with scaling some diagrams so that they each fit on a page (landscape) in my appendix.

Does anyone has some suggestions how to solve this? Any help would be really appreciated.

One of the diagramms looks like this. I also included the "main settings" as I am not sure, if they are important (papersize, header etc.)

\RequirePackage{fix-cm} % Improves appearance of some cm-super fonts
\RequirePackage[l2tabu, orthodox]{nag}    % warns about some obsolete latex constructs
\documentclass[
   12pt,                % font size 12pt
   a4paper,             % layout for DIN A4
   oneside,             % layout for one sided printing
   headinclude,         % include head in layout computation
   headsepline,         % horizontal line below head
   BCOR12mm,            % correction for fixation
   DIV16,               % DIV-value for creating the print space, (see scrguien.pdf)
   parskip=half,         % spacing between paragraphs
   openany,             % chapters may start on even and odd pages
   bibliography=totoc,            % put bibliography into table of contents
   numbers=noenddot,    % chapter numbers without full stop
   headlines=2.1,       %test overfull
   captions=tablehe
ading,   % use table headings with correct spacing
   fleqn                % float equations to left margin
          % 1,5er Zeilenabstand
]{scrbook}[2007/12/24]  % scrbook-Version min. v2.98 from 2007/12/24

\usepackage[utf8]{inputenc}    % change to your encoding (e.g. utf8)
\usepackage[T1]{fontenc}         % correct pdf output (correct umlaut charaters)
\usepackage{lmodern}             % fonts for pdf-file creation (use Type1 instead of Type3) - only needed, if cmsuper is not installed
%                                 % check the resulting pdf-file: fonts should been embedded, subsetted and of type 1 (NOT type 3!)
\usepackage[intlimits]{amsmath}  % place the subscripts and superscripts in the right position
\usepackage{amsfonts}            % additional fonts like \mathbb, \mathfrak
\usepackage{amssymb}             % additional symbols
\usepackage{url}                 % support for urls
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{mdwlist}
\usepackage{filecontents}
\newcommand{\grad}{\ensuremath{^\circ}} %Grad
\usepackage[babel,german=guillemets]{csquotes}


%\usepackage{ngerman}             % new german orthography
\usepackage[ngerman]{babel}
\usepackage{scrpage2}            % head and foot layout
\usepackage{ushort}              % complex values require an underline (use \ushort or \ushortw)
\usepackage{units}               % package for setting units in a typographically correct way (e.g. \unit[3]{cm})
\usepackage{booktabs}            % package provides additional commands to enhance the quality of tables
\usepackage{datetime}            % provides \pdfdate command

\usepackage[german]{fancyref}

\usepackage{setspace}            % Anderthalbzeiliger Zeilenabstand
%\onehalfspacing
%\setstretch{1,6}
\addtolength{\headheight}{3pt} %test Warning using a very small headheight
\linespread{1.3}

\numberwithin{equation}{section} % amsmath: numbering equations

\pagestyle{scrheadings}          % enable scrheadings layout for head and foot

%Fußnoten nicht eingerückt
\usepackage[bottom,hang]{footmisc}
\setlength{\footnotemargin}{0pt}

\ifx\pdfoutput\undefined
 % non pdflatex settings (normal latex compiler assumed)
 \usepackage[dvips]{graphicx}
\else
 % different settings for the pdflatex compiler
 \usepackage[pdftex]{graphicx}
 \usepackage{epstopdf}           % enables automatic conversion from .eps to .pdf graphic files; run MikTeX as "latex --enable-write18"
 \usepackage[pdftex,plainpages=false]{hyperref}
 \pdfcompresslevel=9
 \pdfinfo{
    /CreationDate (D:20050518110000) % date format is year(4) month(2) day(2) hour(2) minute(2) second(2)
    /ModDate      (D:\pdfdate)
 }

\fi








\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pdflscape}
\pgfplotsset{compat=1.8,
            grid style={dashed}}

\begin{filecontents}{Data_Geburt_Tod.csv}
Jahr    Geburten    Sterbefaelle
1602    11  1
1603    20  6
1604    19  6
1605    23  11
1606    18  7
1607    20  6
1608    27  8
1609    21  3
1610    15  84
1611    {}  {}
1612    24  4
1613    28  9
1614    28  3
1615    13  {}
1616    22  5
1617    21  {}
1618    24  5
1619    24  4
1620    5   2
1621    13  3
1622    14  8
1623    15  2
1624    17  1
1625    14  2
1626    14  3
1627    6   1
1628    16  1
1629    15  1
1630    8   5
1631    15  6
1632    7   2
1633    12  13
1634    11  17
1635    1   79
1636    10  38
1637    13  11
1638    1   21
1639    8   4
1640    7   1
1641    5   5
1642    11  1
1643    6   1
1644    17  3
1645    22  2
1646    24  5
1647    22  2
1648    29  5
1649    13  4
1650    27  7
\end{filecontents}


\begin{document}
\begin{landscape}
\begin{tikzpicture}
  \begin{axis}[ybar=2*\pgflinewidth,
            width=1.9\textwidth,height=0.9\textheight,
            xmin=1602,
            title={Bevölkerungsentwicklung zwischen 1600 und 1650},
            xtick={1600,1605,1610,1615,1620,1625,1630,1635,1640,1645,1650},
            x tick label style={/pgf/number format/1000 sep=},
            xlabel={Jahr},
            y tick label style={/pgf/number format/1000 sep=},
            extra y ticks={84, 79},
            extra y tick labels={{84},{79}},
            extra y tick style={grid=major,
                tick label style={xshift=-1cm}},
            ylabel={Personen},
            enlarge x limits=0.01,
            bar width=5pt]
  \pgfplotstableread{Data_Geburt_Tod.csv}\loadedtable;

    \addplot table[x=Jahr, y=Geburten] {\loadedtable};
    \addplot table[x=Jahr, y=Sterbefaelle] {\loadedtable};   
    \legend{Geburten, Sterbefaelle} 
  \end{axis}
\end{tikzpicture}
\end{landscape}

\end{document}
share|improve this question

1 Answer 1

You can adjust the width and height as

        width=1.35\textwidth,
        height=0.9\textheight,

as you did already, but provided incorrect dimensions. On the other hand if this is needed for all plots put it in the \pgfplotsset.

\RequirePackage{fix-cm} % Improves appearance of some cm-super fonts
\RequirePackage[l2tabu, orthodox]{nag}    % warns about some obsolete latex constructs
\documentclass[
   12pt,                % font size 12pt
   a4paper,             % layout for DIN A4
   oneside,             % layout for one sided printing
   headinclude,         % include head in layout computation
   headsepline,         % horizontal line below head
   BCOR12mm,            % correction for fixation
   DIV16,               % DIV-value for creating the print space, (see scrguien.pdf)
   parskip=half,         % spacing between paragraphs
   openany,             % chapters may start on even and odd pages
   bibliography=totoc,            % put bibliography into table of contents
   numbers=noenddot,    % chapter numbers without full stop
   headlines=2.1,       %test overfull
   captions=tablehe
ading,   % use table headings with correct spacing
   fleqn                % float equations to left margin
          % 1,5er Zeilenabstand
]{scrbook}[2007/12/24]  % scrbook-Version min. v2.98 from 2007/12/24

\usepackage[utf8]{inputenc}    % change to your encoding (e.g. utf8)
\usepackage[T1]{fontenc}         % correct pdf output (correct umlaut charaters)
\usepackage{lmodern}             % fonts for pdf-file creation (use Type1 instead of Type3) - only needed, if cmsuper is not installed
%                                 % check the resulting pdf-file: fonts should been embedded, subsetted and of type 1 (NOT type 3!)
\usepackage[intlimits]{amsmath}  % place the subscripts and superscripts in the right position
\usepackage{amsfonts}            % additional fonts like \mathbb, \mathfrak
\usepackage{amssymb}             % additional symbols
\usepackage{url}                 % support for urls
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{mdwlist}
\usepackage{filecontents}
\newcommand{\grad}{\ensuremath{^\circ}} %Grad
\usepackage[babel,german=guillemets]{csquotes}


%\usepackage{ngerman}             % new german orthography
\usepackage[ngerman]{babel}
\usepackage{scrpage2}            % head and foot layout
\usepackage{ushort}              % complex values require an underline (use \ushort or \ushortw)
\usepackage{units}               % package for setting units in a typographically correct way (e.g. \unit[3]{cm})
\usepackage{booktabs}            % package provides additional commands to enhance the quality of tables
\usepackage{datetime}            % provides \pdfdate command

\usepackage[german]{fancyref}

\usepackage{setspace}            % Anderthalbzeiliger Zeilenabstand
%\onehalfspacing
%\setstretch{1,6}
\addtolength{\headheight}{3pt} %test Warning using a very small headheight
\linespread{1.3}

\numberwithin{equation}{section} % amsmath: numbering equations

\pagestyle{scrheadings}          % enable scrheadings layout for head and foot

%Fußnoten nicht eingerückt
\usepackage[bottom,hang]{footmisc}
\setlength{\footnotemargin}{0pt}

\ifx\pdfoutput\undefined
 % non pdflatex settings (normal latex compiler assumed)
 \usepackage[dvips]{graphicx}
\else
 % different settings for the pdflatex compiler
 \usepackage[pdftex]{graphicx}
 \usepackage{epstopdf}           % enables automatic conversion from .eps to .pdf graphic files; run MikTeX as "latex --enable-write18"
 \usepackage[pdftex,plainpages=false]{hyperref}
 \pdfcompresslevel=9
 \pdfinfo{
    /CreationDate (D:20050518110000) % date format is year(4) month(2) day(2) hour(2) minute(2) second(2)
    /ModDate      (D:\pdfdate)
 }

\fi








\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pdflscape}
\pgfplotsset{compat=1.8,
            grid style={dashed},
            }

\begin{filecontents}{Data_Geburt_Tod.csv}
Jahr    Geburten    Sterbefaelle
1602    11  1
1603    20  6
1604    19  6
1605    23  11
1606    18  7
1607    20  6
1608    27  8
1609    21  3
1610    15  84
1611    {}  {}
1612    24  4
1613    28  9
1614    28  3
1615    13  {}
1616    22  5
1617    21  {}
1618    24  5
1619    24  4
1620    5   2
1621    13  3
1622    14  8
1623    15  2
1624    17  1
1625    14  2
1626    14  3
1627    6   1
1628    16  1
1629    15  1
1630    8   5
1631    15  6
1632    7   2
1633    12  13
1634    11  17
1635    1   79
1636    10  38
1637    13  11
1638    1   21
1639    8   4
1640    7   1
1641    5   5
1642    11  1
1643    6   1
1644    17  3
1645    22  2
1646    24  5
1647    22  2
1648    29  5
1649    13  4
1650    27  7
\end{filecontents}


\begin{document}
\begin{landscape}
\begin{tikzpicture}
  \begin{axis}[ybar=2*\pgflinewidth,
            width=1.35\textwidth,
            height=0.9\textheight,
            %width=1.9\textwidth,height=0.9\textheight,
            xmin=1602,
            title={Bevölkerungsentwicklung zwischen 1600 und 1650},
            xtick={1600,1605,1610,1615,1620,1625,1630,1635,1640,1645,1650},
            x tick label style={/pgf/number format/1000 sep=},
            xlabel={Jahr},
            y tick label style={/pgf/number format/1000 sep=},
            extra y ticks={84, 79},
            extra y tick labels={{84},{79}},
            extra y tick style={grid=major,
                tick label style={xshift=-1cm}},
            ylabel={Personen},
            enlarge x limits=0.01,
            bar width=5pt]
  \pgfplotstableread{Data_Geburt_Tod.csv}\loadedtable;

    \addplot table[x=Jahr, y=Geburten] {\loadedtable};
    \addplot table[x=Jahr, y=Sterbefaelle] {\loadedtable};
    \legend{Geburten, Sterbefaelle}
  \end{axis}
\end{tikzpicture}
\end{landscape}

\end{document}

enter image description here

Another option will be to use `tikzscale package. But here you have to put your plot as a separate file. i.e., save

\begin{tikzpicture}
.
.
.
your plot.
.
.
\end{tikzpicture}

as a file plot.tikzand use

\usepackage{tikzscale}

and

\includegraphics[width=<dimen>]{plot.tikz}
share|improve this answer
    
Thanks for your help - that worked pretty well. I just noticed that this solution works only in a doment-enviroment. I just tried to put it in a `begin{figure} end[figure} environment and notices that it wont rotate anymore. Is there possibly a fix for that? I would not really like to abandon captions. –  Sascha Apr 11 at 17:56
    
Okay, I found out. \rotatebox{90}{} was my friend ;-) –  Sascha Apr 11 at 18:04

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.