我不太确定你的目标是什么。要更改字体大小或图片其余部分的大小?有多种可能性可以达到其中任何一个:
我的示例盒子有一个 1cm x 1cm 大盒子:
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
缩放图形元素,但不缩放文本:
\begin{tikzpicture}[scale=0.5]
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
\begin{tikzpicture}[scale=0.5]
\draw (0,0) rectangle (1cm,1cm) -- +(-1,-1);
\node(text) at (0.5cm,0.5cm) {Text};
\end{tikzpicture}
仅缩放坐标(也就是说,如果未指定单位,则使用指定 x、y 和 z 向量的乘积):
\begin{tikzpicture}[x=5mm,y=5mm]
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
显式长度不会因此改变:
\begin{tikzpicture}[x=5mm,y=5mm]
\draw (0,0) rectangle (1cm,1cm) -- +(-1cm,-1cm);
\node(text) at (0.5cm,0.5cm) {Text};
\end{tikzpicture}
缩放所有内容,甚至文本(根据 pgfmanual,不建议这样做):
\begin{tikzpicture}[transform canvas={scale=0.5}]
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
使用 LaTeX 命令具有相同的效果:
\scalebox{0.5}{
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
}
本地更改字体大小,但图形元素的大小不变:
\begin{tikzpicture}[font=\scriptsize]
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
更改所有后续 tikzpicture 环境中的字体大小(\tikzset
也可用于设置上面的选项):
\tikzset{font=\scriptsize}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
\tikzset
在组中保持本地状态:
\begin{minipage}{\linewidth}
\tikzset{font=\scriptsize}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
\end{minipage}
{
\tikzset{font=\scriptsize}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1) -- +(-1,-1);
\node(text) at (0.5,0.5) {Text};
\end{tikzpicture}
不知道是否可以编辑文件graph?.tex
,或者这些是生成的吗?也许您可以将选项传递给生成的程序tikzpicture
环境。否则,只需使用以下命令在所需范围内设置所需选项\tikzset
.
希望,这有帮助。
EDIT:
如果选项(如font=
)在本地定义graph?.tex
,那么它们优先于外部定义的选项。如果是这种情况,您就无法从外部覆盖它们。您必须编辑这些文件。
EDIT:这个“最小”示例对我有用(显示了一个非常大的“Mackenzie Net Sales”,超出了子图的宽度)
\documentclass{article}
\usepackage{fix-cm}
\usepackage{subfig}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.append style={font=\fontsize{100}{120}\selectfont}}
\begin{figure}[h]
\centering
\subfloat[Graph 1]{
\begin{minipage}[h]{0.7\linewidth}
\centering\beginpgfgraphicnamed{graph1}
% \input{graph1.tex}
\endpgfgraphicnamed
\label{fig:graph1}
\end{minipage}}
\hspace{5pt}
\subfloat[Graph 2]{
\begin{minipage}[h]{0.5\linewidth}
\centering
\resizebox{\textwidth}{!}{
%\beginpgfgraphicnamed{graph2}
\begin{tikzpicture}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (79.497,61.429);
\definecolor[named]{drawColor}{rgb}{0.13,0.76,0.43}
\definecolor[named]{fillColor}{rgb}{0.31,0.94,0.66}
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (79.497,61.429);
\definecolor[named]{drawColor}{rgb}{0.13,0.76,0.43}
\definecolor[named]{fillColor}{rgb}{0.31,0.94,0.66}
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (79.497,61.429);
\definecolor[named]{drawColor}{rgb}{0.13,0.76,0.43}
\definecolor[named]{fillColor}{rgb}{0.31,0.94,0.66}
\definecolor[named]{fillColor}{rgb}{1.00,1.00,1.00}
\draw[fill=fillColor,draw opacity=0.00,] ( 0.00, 0.00) rectangle (79.497,61.429);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (79.497,61.429);
\definecolor[named]{drawColor}{rgb}{0.13,0.76,0.43}
\definecolor[named]{fillColor}{rgb}{0.31,0.94,0.66}
\definecolor[named]{drawColor}{rgb}{0.00,0.00,0.00}
\node[rotate= 90.00,color=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 1.00] at ( 1.592,31.059) {Mackenzie Net Sales};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (79.497,61.429);
\definecolor[named]{drawColor}{rgb}{0.13,0.76,0.43}
\definecolor[named]{fillColor}{rgb}{0.31,0.94,0.66}
\end{scope}
\end{tikzpicture}
}
%\endpgfgraphicnamed
\label{fig:graph2}
\end{minipage}}
\subfloat[Graph 3]{
\begin{minipage}[h]{0.5\linewidth}
\centering\beginpgfgraphicnamed{graph3}
% \input{graph3.tex}
\endpgfgraphicnamed
\label{fig:graph3}
\end{minipage}}
\caption{Three Graphs}
\end{figure}
\end{document}
请测试这是否也适合您。如果是的话,就尝试修改这个,直到它不再起作用为止。重大变化是什么?