缩放至不同的纸张尺寸?

缩放至不同的纸张尺寸?

我使用了问题的“第四版”极坐标直方图用于构建我的图表。

导出的 PDF 文档适合 A4 纸。我如何将其缩放到更大的纸张格式?A3、A2、A1 A0 纸?当然,图形和文本应该缩放。谢谢!

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{ifthen}
\tikzset{
  orig/.style={
    hist 1/.style={fill=red!70!gray},
    hist 2/.style={fill=blue!60!white},
    hist 3/.style={fill=green!50!gray},
    arrow group/.style={draw,color=black,very thick,latex-latex},
    target/.style={fill=pink!60!black,draw=black,
      line width=1pt,double distance=1pt,double=white},
    rev text on arc/.style={
      decorate,decoration={text along path,
        text={##1},text align={align=center},
        text color=black,reverse path}
    },
    text on arc/.style={
      decorate,decoration={text along path,
        text={##1},text align={align=center},
        text color=black,
      },
    },
    major tick/.style={draw=white,thick},
    minor tick/.style={draw=white,thin,draw opacity=.5},
    tick label/.style={font=\tiny\bfseries},
    text=black,
    font=\bfseries\sffamily,
  },
  dartstyle/.style={
    hist 1/.style={fill=red!80!white},
    hist 2/.style={fill=yellow!60!white},
    hist 3/.style={fill=green!70!black},
    arrow group/.style={draw=white,white,very thick,latex-latex},
    target/.style={fill=black,draw=black,
      line width=1pt,double distance=1pt,double=white},
    rev text on arc/.style={
      decorate,decoration={text along path,
        text={##1},text align={align=center},
        text color=white,reverse path}
    },
    text on arc/.style={
      decorate,decoration={text along path,
        text={##1},text align={align=center},
        text color=white}
    },
    major tick/.style={draw=white,thick},
    minor tick/.style={draw=white,thin,draw opacity=.5},
    tick label/.style={font=\tiny\bfseries},
    text=white,
    font=\bfseries\sffamily,
  },
}

\def\astep{9} % step (degree) between sectors
\def\mstep{3} % half width (degree) of each sector
\def\min{8mm} % min distance from center
\def\max{4cm} % max distance from center

\def\mydata{%
  First Group/{%
    xxx/{10,30,60},%
    aab/{20,30,50},%
    aba/{30,30,40},%
    aad/{40,30,30},%
    aca/{50,30,20},%
    zcb/{60,10,30},%
    aaa/{10,30,60},%
    aab/{30,30,40},%
    aba/{10,80,10},%
    aad/{30,30,40},%
    aca/{10,30,60}%
  },%
  Second Group/{%
    yyy/{60,10,30},%
    zcb/{60,10,30},%
    aaa/{10,30,60},%
    aab/{30,30,40},%
    aba/{10,80,10},%
    aad/{30,30,40},%
    aca/{10,30,60},%
    zcb/{60,10,30},%
    zcb/{75,10,15},%
    aaa/{10,30,60}%
  },%
  Third Group/{%
    zzz/{30,30,40},%
    aba/{10,80,10},%
    aad/{30,30,40},%
    aca/{10,30,60},%
    zcb/{60,10,30},%
    zcb/{60,10,30},%
    aaa/{10,30,60},%
    aab/{30,30,40},%
    aba/{10,80,10},%
    aad/{30,30,40},%
    aca/{10,30,60},%
    zcb/{60,30,10}% 
  }%
}

\begin{document}
\begin{tikzpicture}[orig]
  \tikzset{
    declare function={
      secttoangle(\sect)=(\sect)*\astep;
      percenttodist(\percent)=\min+(\max-\min)/100*\percent;
    },
  }

  \path[target]
  circle(\max+1.6cm);

  \def\cursectinit{-.666}
  \foreach \curgroup/\curdata in \mydata {
    \foreach \curlabel/\values [count=\cp] in \curdata {
      % angle for this current label
      \pgfmathsetmacro{\angle}{secttoangle(\cursectinit+\cp)}
      % percent
      \xdef\total{0}
      % histogram
      \foreach \val [count=\cv] in \values {
        \pgfmathsetmacro{\nexttotal}{\total+\val}
        \pgfmathsetmacro{\dmin}{percenttodist(\total)}
        \pgfmathsetmacro{\dmax}{percenttodist(\nexttotal)}
        % sector
        \path[hist \cv=\angle] (\angle+\mstep:\dmin pt)
        arc(\angle+\mstep:\angle-\mstep:\dmin pt) -- (\angle-\mstep:\dmax pt)
        arc(\angle-\mstep:\angle+\mstep:\dmax pt) -- cycle;
        % iteration
        \xdef\total{\nexttotal}
      }
      % label (with autorotation)
      \pgfmathtruncatemacro{\revlab}{and(\angle>90,\angle<270)?1:0}
      \ifthenelse{\equal{\revlab}{1}}{ 
        \node[rotate=180+\angle,anchor=east] at (\angle:\max) {\curlabel};
      }{
        \node[rotate=\angle,anchor=west] at (\angle:\max) {\curlabel};
      }
    }
    % group limits
    \pgfmathsetmacro{\newsectinit}{\cursectinit+\cp}
    \pgfmathsetmacro{\angleinit}{secttoangle(\cursectinit + 1)-\mstep}
    \pgfmathsetmacro{\anglefinal}{secttoangle(\newsectinit)+\mstep}
    % group label
    {
      \Large\bfseries\sffamily
      \pgfmathtruncatemacro{\anglem}{(\angleinit+\anglefinal)/2}
      \pgfmathtruncatemacro{\revtext}{and(\anglem>0,\anglem<180)?1:0}
      \ifthenelse{\equal{\revtext}{1}}{ 
        \draw[rev text on arc=\curgroup] (\angleinit:\max+1.1cm)
        arc(\angleinit:\anglefinal:\max+1.1cm);
      }{
        \draw[text on arc=\curgroup] (\angleinit:\max+1.1cm+.5em)
        arc(\angleinit:\anglefinal:\max+1.1cm+.5em);
      }
    }
    % group arrow
    \path[arrow group]
    (\angleinit:\max+9mm) arc(\angleinit:\anglefinal:\max+9mm);
    % iteration
    \pgfmathsetmacro{\newsectinit}{\newsectinit+1}
    \xdef\cursectinit{\newsectinit}
  }

  % level ticks
  \pgfmathsetmacro{\angleinit}{secttoangle(0)}
  \pgfmathsetmacro{\anglefinal}{secttoangle(\cursectinit-1)+\mstep}
  % major ticks with labels
  \foreach \percent in {0,50,100}{
    \pgfmathsetmacro{\dist}{percenttodist(\percent)}
    % tick
    \path[major tick] (\angleinit:\dist pt)
    arc(\angleinit:\anglefinal:\dist pt);
    % label
    \node[tick label,below,rotate=secttoangle(0)]
    at ({secttoangle(0)}:\dist pt) {\percent\%};
  }
  % minor ticks
  \foreach \percent in {10,20,30,40,60,70,80,90}{
    \pgfmathsetmacro{\dist}{percenttodist(\percent)}
    % tick
    \path[minor tick] (\angleinit:\dist pt)
    arc(\angleinit:\anglefinal:\dist pt);
  }

  % legend
  \foreach \mycat [count=\c] in {Bad,Mediocre,Good}{
    \path[hist \c=0] (2.75,-.5-.5*\c) rectangle ++(.2,.2) ++(0,-.1)
    node[right]{\mycat};
  }
\end{tikzpicture}
\end{document}

答案1

您可以\includegraphics使用graphicx包将完成的图表加载到另一个文档中。然后,使用width=height=键调整大小。

假设你diagram.pdf使用上述代码创建了该文件,请执行以下操作

\documentclass{standalone}

\usepackage{graphicx}
\usepackage{parskip}

\begin{document}

    \includegraphics[width=\textwidth]{diagram.pdf}

\end{document}

相关内容