我有以下代码来创建4 x 5
图形,但是当我将此代码放入我的文档中时,生成的图形总是放置在右边太多的位置。
我怎样才能将图形稍微向左移动一点?
\documentclass{article}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{wrapfig}
\usepackage{epstopdf}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\graphics}[1]{\includegraphics[width=4.cm]{#1}}
\begin{document}
\begin{landscape}
\begin{center}
\begin{tikzpicture}[
mygrid/.style={matrix of nodes,
row sep=-30\pgflinewidth, column sep=-30\pgflinewidth,
nodes={minimum size=1cm}, nodes in empty cells},
]
\matrix (m) [mygrid]
{
|[shift={(-2mm,6mm)},rotate=270]|10 droplets &\graphics{par-dmso-sam1-10-0.jpg}&\graphics{par-dmso-sam1-10-5.jpg}&\graphics{par-dmso-sam1-10-7.jpg}&\graphics{par-dmso-sam1-10-8.jpg}&\graphics{par-dmso-sam1-10-88_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|50 droplets &\graphics{par-dmso-sam1-50-0.jpg}&\graphics{par-dmso-sam1-50-5.jpg}&\graphics{par-dmso-sam1-50-10.jpg}&\graphics{par-dmso-sam1-50-15.jpg}&\graphics{par-dmso-sam1-50-255_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|100 droplets&\graphics{par-dmso-sam1-100-0.jpg}&\graphics{par-dmso-sam1-100-15.jpg}&\graphics{par-dmso-sam1-100-30.jpg}&\graphics{par-dmso-sam1-100-45.jpg}&\graphics{par-dmso-sam1-100-600_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|250 droplets &\graphics{par-dmso-sam1-250-0.jpg}&\graphics{par-dmso-sam1-250-30.jpg}&\graphics{par-dmso-sam1-250-60.jpg}&\graphics{par-dmso-sam1-250-75.jpg}&\graphics{par-dmso-sam1-250-950_labeld.jpg}\\
& & & & \\
};
\draw[thick,-latex] ([shift={(-2mm,-2mm)}]m-4-2.south west) --
([shift={(50mm,-2mm)}]m-4-5.south east)
node[pos=0.5,below=10mm]{Time/minutes};
\draw[thick,-latex] ([shift={(-2mm,-2mm)}]m-4-2.south west) --
([shift={(-1mm,10mm)}]m-1-2.north west)
node[pos=0.5,left=15mm,rotate=90,anchor=center]{Quantities};
\end{tikzpicture}
\end{center}
\end{landscape}
\end{document}
答案1
我能够通过滥用 minipage 将超大尺寸的 tikzpicture(相对于文本区域)居中。为了演示目的,我添加了绿色的边界框。
\documentclass{article}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{wrapfig}
\usepackage{epstopdf}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\graphics}[1]{\includegraphics[width=4.cm]{#1}}
%\usepackage{showframe}
\begin{document}
\begin{landscape}
\begin{minipage}[c][\textwidth][c]{\linewidth}
\centering
\begin{tikzpicture}[
mygrid/.style={matrix of nodes,
row sep=-30\pgflinewidth, column sep=-30\pgflinewidth,
nodes={minimum size=1cm}, nodes in empty cells},
]
\matrix (m) [mygrid]
{
|[shift={(-2mm,6mm)},rotate=270]|10 droplets &\graphics{par-dmso-sam1-10-0.jpg}&\graphics{par-dmso-sam1-10-5.jpg}&\graphics{par-dmso-sam1-10-7.jpg}&\graphics{par-dmso-sam1-10-8.jpg}&\graphics{par-dmso-sam1-10-88_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|50 droplets &\graphics{par-dmso-sam1-50-0.jpg}&\graphics{par-dmso-sam1-50-5.jpg}&\graphics{par-dmso-sam1-50-10.jpg}&\graphics{par-dmso-sam1-50-15.jpg}&\graphics{par-dmso-sam1-50-255_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|100 droplets&\graphics{par-dmso-sam1-100-0.jpg}&\graphics{par-dmso-sam1-100-15.jpg}&\graphics{par-dmso-sam1-100-30.jpg}&\graphics{par-dmso-sam1-100-45.jpg}&\graphics{par-dmso-sam1-100-600_labeld.jpg}\\
|[shift={(-2mm,6mm)},rotate=270]|250 droplets &\graphics{par-dmso-sam1-250-0.jpg}&\graphics{par-dmso-sam1-250-30.jpg}&\graphics{par-dmso-sam1-250-60.jpg}&\graphics{par-dmso-sam1-250-75.jpg}&\graphics{par-dmso-sam1-250-950_labeld.jpg}\\
& & & & \\
};
\draw[thick,-latex] ([shift={(-2mm,-2mm)}]m-4-2.south west) --
([shift={(50mm,-2mm)}]m-4-5.south east)
node[pos=0.5,below=10mm]{Time/minutes};
\draw[thick,-latex] ([shift={(-2mm,-2mm)}]m-4-2.south west) --
([shift={(-1mm,10mm)}]m-1-2.north west)
node[pos=0.5,left=15mm,rotate=90,anchor=center]{Quantities};
\draw[green] (current bounding box.south west) rectangle (current bounding box.north east);% just for show
\end{tikzpicture}
\end{minipage}
\end{landscape}
\end{document}
答案2
看来楼主忘记了他的问题...无论如何,还有一个答案:
- 作为基础我约翰·科米洛回答
- 而不是
landscape
我使用sidewaystable
;这是minipage
多余的 - 增加文本区域(借助包“几何”)。如果不希望这样,那么您有两种方法可以将图像放入文本区域:
- 局部增加文本区域(例如使用
changepage
数据包) - 减小图像尺寸
- 局部增加文本区域(例如使用
- 减少矩阵大小(删除空行)
- 根据矩阵边缘绘制坐标轴
- 定义第一列的样式并以此简化其中单元格的代码。
graphicx
添加带有选项的包demo
以允许查看演示图像- 减小图像尺寸(从 40 毫米到 35 毫米),但在使用真实图像时应再次增加(它们具有不同的纵横比
- 对于在矩阵中插入图像的新命令,我选择了新名称,因为对于它来说,使用已经使用的名称
latext
是不合理的
姆韦:
\documentclass{article}
\usepackage[showframe,margin=30mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\img}[1]{\includegraphics[width=35mm]{#1}}
%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{sidewaysfigure}
\centering
\begin{tikzpicture}[
mygrid/.style={matrix of nodes,
row sep=-1\pgflinewidth, column sep=-1\pgflinewidth,
inner sep=1mm,
nodes={inner sep=1pt},
nodes in empty cells},
column 1/.style = {nodes={rotate=270,anchor=east,xshift=-7mm}}
]
\matrix (m) [mygrid]
{
10 droplets
& \img{par-dmso-sam1-10-0.jpg} & \img{par-dmso-sam1-10-5.jpg}
& \img{par-dmso-sam1-10-7.jpg} & \img{par-dmso-sam1-10-8.jpg}
& \img{par-dmso-sam1-10-88_labeld.jpg}\\
50 droplets
& \img{par-dmso-sam1-50-0.jpg} & \img{par-dmso-sam1-50-5.jpg}
& \img{par-dmso-sam1-50-10.jpg} & \img{par-dmso-sam1-50-15.jpg}
& \img{par-dmso-sam1-50-255_labeld.jpg}\\
100 droplets
& \img{par-dmso-sam1-100-0.jpg} & \img{par-dmso-sam1-100-15.jpg}
& \img{par-dmso-sam1-100-30.jpg}& \img{par-dmso-sam1-100-45.jpg}
& \img{par-dmso-sam1-100-600_labeld.jpg}\\
250 droplets
& \img{par-dmso-sam1-250-0.jpg} & \img{par-dmso-sam1-250-30.jpg}
& \img{par-dmso-sam1-250-60.jpg}& \img{par-dmso-sam1-250-75.jpg}
& \img{par-dmso-sam1-250-950_labeld.jpg}\\
};
\draw[thick,-latex] (m.south west)
-- node[below] {Time/minutes} (m.south east);
\draw[thick,-latex] (m.south west)
-- node[sloped,above] {Quantities} (m.north west);
\end{tikzpicture}
\end{sidewaysfigure}
\end{document}