我之前已经发过这个问题,但我无法添加这个新代码(太长了)。所以我重新发了一次。这是我的代码。图像一个接一个地对齐。我希望它们并排。我很抱歉,这显然是我无法弄清楚的小事。我很感激您的反馈。此外,我如何在两者下方添加一个文本框来描述它们是什么?我正在写论文,标题+描述应该在图表下方。非常感谢您抽出时间。
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{width=10cm,compat=1.9}
\pgfplotsset{domain=-1:1}
\begin{tikzpicture}[baseline]
\begin{axis}[
title={Men},
xlabel={age (years)},
ylabel={rates per 100 000},
xticklabels={[5-9],,[15-19],,[25-29],,[35-39],,[45-49],,[55-59],,[65-69],,[75-79],,[85+]},
xmin=0,xmax=180,
ymin=0, ymax=700,
xtick={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170},
x tick label style={rotate=60, anchor=east},
ytick={0,50,100,150,200,250,300,350,400,450,500,550,600,650,700},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0)(50,0)(60,0)(70,0.4)(80,5.8)(90,28.9)(100,98.1)(110,236.4)(120,414.1)(130,631.3)(140,660.1)(150,644.2)(160,572.1)(170,621.6)
};
\addplot[
color=red,
mark=square,
]
coordinates {
(0,0.5)(10,0.5)(20,0)(30,0)(40,0.4)(50,0)(60,1.3)(70,2.2)(80,6.2)(90,18.6)(100,45.8)(110,92.7)(120,166.0)(130,290.3)(140,411.2)(150,491.1)(160,529.3)(170,474.4)
};
\addplot[
color=brown,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.9)(40,0.8)(50,2.1)(60,5.7)(70,7.4)(80,17)(90,13.9)(100,53.8)(110,98)(120,151.3)(130,243.8)(140,318.6)(150,398.7)(160,461.6)(170,456.7)
};
\addplot[
color=black,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,0.8)(50,0.8)(60,3.1)(70,4.8)(80,9.9)(90,13.9)(100,29.9)(110,52.7)(120,87.9)(130,146.5)(140,199.4)(150,267.4)(160,329.7)(170,327.3)
};
\addplot[
color=green,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,0.4)(50,0.8)(60,0.9)(70,1.8)(80,4.6)(90,9.6)(100,17)(110,35.6)(120,70.6)(130,105.7)(140,164.1)(150,218.8)(160,272.7)(170,314.6)
};
\legend{Prostate, Lungs/bronchus, Colon/rectum, Colon, Urinary bladder}
\end{axis}
\end{tikzpicture}%
\hspace{0.10cm}
\begin{tikzpicture}[baseline]
\begin{axis}[
title={Women},
xlabel={age (years)},
ylabel={rates per 100 000},
xticklabels={[5-9],,[15-19],,[25-29],,[35-39],,[45-49],,[55-59],,[65-69],,[75-79],,[85+]},
xmin=0,xmax=180,
ymin=0, ymax=400,
xtick={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170},
x tick label style={rotate=60, anchor=east},
ytick={0,50,100,150,200,250,300,350,400,450,500,550,600,650,700},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,2.2)(50,9)(60,25.3)(70,52.2)(80,104.9)(90,165.8)(100,207.7)(110,247.4)(120,303.8)(130,365.6)(140,366.5)(150,358.5)(160,318.9)(170,326.5)
};
\addplot[
color=red,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0.4)(50,0.4)(60,0.4)(70,2.6)(80,8.4)(90,23.9)(100,55.5)(110,91.4)(120,147)(130,219.2)(140,284.4)(150,335.6)(160,293)(170,214.9)
};
\addplot[
color=brown,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.5)(40,0.4)(50,2.1)(60,3.5)(70,7.9)(80,14.6)(90,24.6)(100,49.1)(110,67)(120,102.6)(130,147)(140,204)(150,270.9)(160,330.1)(170,355)
};
\addplot[
color=black,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.5)(40,0.4)(50,0.9)(60,2.2)(70,4.4)(80,8.8)(90,14.8)(100,29.7)(110,40.9)(120,70.2)(130,107.3)(140,154)(150,202.2)(160,252.2)(170,287.3)
};
\addplot[
color=green,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0)(50,0.9)(60,2.6)(70,7.9)(80,9.6)(90,23.9)(100,46)(110,70.1)(120,97.6)(130,94.7)(140,89.7)(150,74.7)(160,65.5)(170,46.3)
};
\legend{Breast, Lungs/bronchus, Colon/rectum, Colon, Corpus uteri}
\end{axis}
\end{tikzpicture}
\end{document}
这是我得到的:
答案1
Tikzpictures 只是一个盒子,它们的位置与比较X
相同
X X
到
X
X
框之间有空行,就像X
段落分隔符一样,如果X
您删除它,它们就会并排出现:
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{width=10cm,compat=1.9}
\pgfplotsset{domain=-1:1}
\begin{tikzpicture}[baseline]
\begin{axis}[
title={Men},
xlabel={age (years)},
ylabel={rates per 100 000},
xticklabels={[5-9],,[15-19],,[25-29],,[35-39],,[45-49],,[55-59],,[65-69],,[75-79],,[85+]},
xmin=0,xmax=180,
ymin=0, ymax=700,
xtick={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170},
x tick label style={rotate=60, anchor=east},
ytick={0,50,100,150,200,250,300,350,400,450,500,550,600,650,700},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0)(50,0)(60,0)(70,0.4)(80,5.8)(90,28.9)(100,98.1)(110,236.4)(120,414.1)(130,631.3)(140,660.1)(150,644.2)(160,572.1)(170,621.6)
};
\addplot[
color=red,
mark=square,
]
coordinates {
(0,0.5)(10,0.5)(20,0)(30,0)(40,0.4)(50,0)(60,1.3)(70,2.2)(80,6.2)(90,18.6)(100,45.8)(110,92.7)(120,166.0)(130,290.3)(140,411.2)(150,491.1)(160,529.3)(170,474.4)
};
\addplot[
color=brown,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.9)(40,0.8)(50,2.1)(60,5.7)(70,7.4)(80,17)(90,13.9)(100,53.8)(110,98)(120,151.3)(130,243.8)(140,318.6)(150,398.7)(160,461.6)(170,456.7)
};
\addplot[
color=black,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,0.8)(50,0.8)(60,3.1)(70,4.8)(80,9.9)(90,13.9)(100,29.9)(110,52.7)(120,87.9)(130,146.5)(140,199.4)(150,267.4)(160,329.7)(170,327.3)
};
\addplot[
color=green,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,0.4)(50,0.8)(60,0.9)(70,1.8)(80,4.6)(90,9.6)(100,17)(110,35.6)(120,70.6)(130,105.7)(140,164.1)(150,218.8)(160,272.7)(170,314.6)
};
\legend{Prostate, Lungs/bronchus, Colon/rectum, Colon, Urinary bladder}
\end{axis}
\end{tikzpicture}%
%
\hspace{0.10cm}%
%
\begin{tikzpicture}[baseline]
\begin{axis}[
title={Women},
xlabel={age (years)},
ylabel={rates per 100 000},
xticklabels={[5-9],,[15-19],,[25-29],,[35-39],,[45-49],,[55-59],,[65-69],,[75-79],,[85+]},
xmin=0,xmax=180,
ymin=0, ymax=400,
xtick={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170},
x tick label style={rotate=60, anchor=east},
ytick={0,50,100,150,200,250,300,350,400,450,500,550,600,650,700},
legend pos=north west,
ymajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.4)(40,2.2)(50,9)(60,25.3)(70,52.2)(80,104.9)(90,165.8)(100,207.7)(110,247.4)(120,303.8)(130,365.6)(140,366.5)(150,358.5)(160,318.9)(170,326.5)
};
\addplot[
color=red,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0.4)(50,0.4)(60,0.4)(70,2.6)(80,8.4)(90,23.9)(100,55.5)(110,91.4)(120,147)(130,219.2)(140,284.4)(150,335.6)(160,293)(170,214.9)
};
\addplot[
color=brown,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.5)(40,0.4)(50,2.1)(60,3.5)(70,7.9)(80,14.6)(90,24.6)(100,49.1)(110,67)(120,102.6)(130,147)(140,204)(150,270.9)(160,330.1)(170,355)
};
\addplot[
color=black,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0.5)(40,0.4)(50,0.9)(60,2.2)(70,4.4)(80,8.8)(90,14.8)(100,29.7)(110,40.9)(120,70.2)(130,107.3)(140,154)(150,202.2)(160,252.2)(170,287.3)
};
\addplot[
color=green,
mark=square,
]
coordinates {
(0,0)(10,0)(20,0)(30,0)(40,0)(50,0.9)(60,2.6)(70,7.9)(80,9.6)(90,23.9)(100,46)(110,70.1)(120,97.6)(130,94.7)(140,89.7)(150,74.7)(160,65.5)(170,46.3)
};
\legend{Breast, Lungs/bronchus, Colon/rectum, Colon, Corpus uteri}
\end{axis}
\end{tikzpicture}
\end{document}
编辑后,这是我的第二张图片:
我可以对齐此框并在其下方添加一个文本框吗?如果您能给我提供一些文档,我将不胜感激。谢谢!