旋转 PGF 图形并使其居中

旋转 PGF 图形并使其居中

我有一个在 MS Visio 中创建的 PDF 图形。我使用 向图形添加了文本qtix。代码粘贴如下:

\begin{tikzpicture}[scale=0.30]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node at (8,-0.5) {Ground};
\node at (-0.5,-0.5) {Ground};
\node at (-9,-0.5) {Ground};

\node at (14.5,9.1) {Public grid; phase A};
\node at (14.5,8.3) {phase A};
\node at (14.5,7.5) {phase B};
\node at (14.5,6.7) {phase C};

\node at (14.5,2.3) {Railway grid};
\node at (14.5,1.5) {catenary};
\node at (14.5,0.7) {rail/ground};

\node at (11.5,3.8) {Transformer};
\node at (3.0,3.8) {Transformer};
\node at (-5.5,3.8) {Transformer};

\end{tikzpicture}

该图形更偏向横向,因此我想在文档中旋转该图形。该图形附在下面。

问题是我现在不知道如何旋转命令插入的图形\input\includegraphics命令可以使用旋转,但每个文本也需要旋转。这样做时,图像居中失败。我也试过了。请参阅下面的代码:

\begin{tikzpicture}[rotate=90,scale=0.32]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node[rotate=90] at (8,-0.5) {Ground};
\node[rotate=90] at (-0.5,-0.5) {Ground};
\node[rotate=90] at (-9,-0.5) {Ground};

\node[rotate=90] at (14.5,9.1) {Public grid; phase A};
\node[rotate=90] at (14.5,8.3) {phase A};
\node[rotate=90] at (14.5,7.5) {phase B};
\node[rotate=90] at (14.5,6.7) {phase C};

\node[rotate=90] at (14.5,2.3) {Railway grid};
\node[rotate=90] at (14.5,1.5) {catenary};
\node[rotate=90] at (14.5,0.7) {rail/ground};

\node[rotate=90] at (11.5,3.8) {Transformer};
\node[rotate=90] at (3.0,3.8) {Transformer};
\node[rotate=90] at (-5.5,3.8) {Transformer};


\end{tikzpicture}

我的代码的主要文档部分如下所示:

\begin{figure}
    \centering
    \input{Visioritning2.pgf}
    \caption{A simplified illustration of how the three-phase grid commonly feeds the railway when using substation transformers}
    \label{Figure:SimplifiedTransformerSubstation}
\end{figure}

那么,有什么建议我应该怎么做吗?主要问题是:

  • 如何旋转和居中 PGF 创建的基于 PDF 的图形并在其上添加解释性文字?
  • 在 PGF 代码中进行旋转是否更好,或者在语句中或语句之前进行旋转是否更好\input

答案1

\rotatebox{<angle>}{<content>}您可以使用标准graphicx包中的宏(无论如何已经由 TikZ 加载)旋转一般材料,例如整个图片,例如尝试\rotatebox{90}{\input{<filename>}}

这看起来也是一个很好的用例standalone。v1.0 版本提供了\includestandalone[<options, incl. angle>]{<code file, like your .pgf>}。这还允许您自行编译图片,这在创建过程中非常有用。


% Visioritning2.tex
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.30]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node at (8,-0.5) {Ground};
\node at (-0.5,-0.5) {Ground};
\node at (-9,-0.5) {Ground};

\node at (14.5,9.1) {Public grid; phase A};
\node at (14.5,8.3) {phase A};
\node at (14.5,7.5) {phase B};
\node at (14.5,6.7) {phase C};

\node at (14.5,2.3) {Railway grid};
\node at (14.5,1.5) {catenary};
\node at (14.5,0.7) {rail/ground};

\node at (11.5,3.8) {Transformer};
\node at (3.0,3.8) {Transformer};
\node at (-5.5,3.8) {Transformer};

\end{tikzpicture}
\end{document}

% Main document
\documentclass{article}% or any other
\usepackage{tikz}
\usepackage{standalone}
\begin{document}
% ...
\begin{figure}
    \centering
    \includestandalone[angle=90]{Visioritning2}
    \caption{A simplified illustration of how the three-phase grid commonly feeds the railway when using substation transformers}
    \label{Figure:SimplifiedTransformerSubstation}
\end{figure}
% ...
\end{document}

相关内容