减小图表尺寸

减小图表尺寸

我的图表目前很大,我想缩小它。

\documentclass[a4paper,12p]{report}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \begin{center}
        \begin{tikzpicture}[rounded corners,ultra thick]
        circles
        \shade[ball color=green] (0,0) circle (.5cm);
        \shade[ball color=blue] (-4,4) circle (.5cm);
        \shade[ball color=yellow] (0,4) circle (.5cm);
        \shade[ball color=red] (4,4) circle (.5cm);
        \shade[ball color=cyan] (-2,-4) circle (.5cm);
        \shade[ball color=orange] (2,-4) circle (.5cm);
        \draw (0,0) node[minimum size=2cm] {$A_e$};
        \draw (0,4) node[minimum size=2cm] {$I_m$};
        \draw (4,4) node[minimum size=2cm] {$I_s$};
        \draw (-4,4) node[minimum size=2cm] {$S$};
        \draw (-2,-4) node[minimum size=2cm] {$P_s$};
        \draw (2,-4) node[minimum size=2cm] {$P_I$};

    \draw[->] (-5.5,4) -- (-4.5,4);
    \draw[->] (-3.5,4) -- (-0.5,4);
    \draw[->] (0.5,4) -- (3.5,4);
    \draw[->] (-4,4.5) -- (-4,5.5);
    \draw[->] (0,4.5) -- (0,6);
    \draw[->] (4.2,4.4) -- (4.8,5.5);
    \draw[->] (4.5,4) -- (5.5,4);
    \draw[->] (0.4,0) -- (1.3,0);
    \draw[->] (1,-1.5) -- (0,-0.4);
    \draw[->] (-3.5,-4) -- (-2.5,-4);
    \draw[->] (-1.8,-4.4) -- (-3,-5);
    \draw[->] (-1.5,-4) -- (1.5,-4);
    \draw[->] (2.5,-4) -- (3.5,-4); 
    \draw[<-, dashed] (-3.8,3.5) -- (2,-3.5);
    \draw[->, dashed] (-0.3,-0.4) -- (-1.8,-3.7);
    \node at (-5,4.3) {$\pi$};
    \node at (-4.1,6) {$\mu S$};
    \node at (-2.5,4.3) {$\beta_h P_IS$};
    \node at (5,5.8) {$\delta I_s$};
    \node at (5.9,4) {$\mu I_s$};
    \node at (1.8,0) {$\phi A_e$};
    \node at (0,6.5) {$\mu I_m$};
    \node at (2,4.3) {$\sigma I_m$};
    \node at (1.5,-2) {$\epsilon P_I$};
    \node at (-3,-3.6) {$\theta P_N$};
    \node at (-3.5,-5.3) {$\theta Ps$};
    \node at (-0.2,-3.6) {$\beta_p(P_I+\gamma A_e)P_s$};
    \node at (2.9,-3.6) {$\theta P_I$};
    \end{tikzpicture}
    \caption{Model Diagram for HPAI dynamics}\label{fig:1}
\end{center}
\end{figure}
\end{document}

答案1

我会重绘图像 :)。在此我会改变:

  • 球的定位(我会使用相对定位而不是绝对定位)
  • 用球阴影定义节点
  • 用于quotes边缘标记
  • 使用字体大小\small

除此之外,代码更加简洁,现在可以通过改变字体大小来改变图像node distance大小(如果需要):

在此处输入图片描述

\documentclass[a4paper,12p]{report}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, quotes}

%-------------------------------------- only for show page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.25pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}
\centering
    \begin{tikzpicture}[
    node distance = 11mm and 33mm,
             font = \small,
      Ball/.style = {circle, shading=ball,
                     ball color=#1,
                     minimum size=7mm, inner sep=1pt},
        LA/.style = {thick, -Straight Barb},
every edge quotes/.append style = {inner sep=1pt}
                        ]
\node   (n11)   [Ball=blue]                     {$S$};
\node   (n12)   [Ball=yellow,right=of n11]      {$I_m$};
\node   (n13)   [Ball=red,right=of n12]         {$I_s$};
%
\node   (n21)   [Ball=green,below=of n12]       {$A_e$};
%
\node   (n31)   [Ball=cyan,below left=of n21]      {$P_s$};
\node   (n32)   [Ball=orange, right=of n31]             {$P_I$};
%
\draw[LA]
    ([xshift=-13mm] n11.west)   edge ["$\pi$"]          (n11)
    (n11)                       edge ["$\mu I_s$"] +    (0,13mm)
    (n11)                       edge ["$\beta_h P_IS$"] (n12)
    (n12)                       edge ["$\delta I_s$"]   (n13)
    (n12)                       edge ["$\mu I_m$"] +    (0,13mm)
    (n13)                       edge ["$\mu I_s$"] +    (45:13mm)
    (n13)                       edge ["$\mu S$"] +      (13mm,0)
%
    (n21)       edge ["$\phi A_e$"] +                   (13mm,0)
    (n21) + (-45:13mm)      edge ["$\epsilon P_I$"]     (n21)
%
    ([xshift=-13mm] n31.west)   edge ["$\theta P_N$"]   (n31)
    (n31)       edge ["$\theta P_s$"] +                 (-45:13mm)
    (n31)       edge ["$\beta_p(P_I+\gamma A_e)P_s$"]   (n32)
    (n32)        to  ["$\theta P_I$"] +                 (13mm,0)
    ;
\draw[LA, dashed]   (n11) edge (n32)
                    (n21)  --  (n31);
    \end{tikzpicture}
\caption{Model Diagram for HPAI dynamics}\label{fig:1}
    \end{figure}
\end{document}

注意:红线表示文档文本宽度。

答案2

最懒惰选项是使用\resizebox{\linewidth}{!}{<content>}。它很丑,而且会使字体变小,但却是获得结果的最快方法。

相关内容