我现在遇到一些问题,需要缩放一些图表才能使它们分别适合附录中的一页(横向)。
有人能给出一些解决此问题的建议吗?任何帮助都将不胜感激。
其中一个图表如下所示。我还包含了“主要设置”,因为我不确定它们是否重要(纸张大小、页眉等)。
\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}
答案1
您可以调整width
和height
width=1.35\textwidth,
height=0.9\textheight,
就像您已经做的那样,但提供了不正确的尺寸。另一方面,如果所有图都需要它,请将其放入\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}
另一个选择是使用“tikzscale 包。但在这里你必须将你的图作为单独的文件。即保存
\begin{tikzpicture}
.
.
.
your plot.
.
.
\end{tikzpicture}
作为文件plot.tikz
并使用
\usepackage{tikzscale}
和
\includegraphics[width=<dimen>]{plot.tikz}