缩放 tikz 图

缩放 tikz 图

我有一个用 Tikz 制作的图表,它看起来像这样:

在此处输入图片描述

我想更清楚地说明“xx”属于哪条边。该怎么做?

首先,我尝试缩放整个 tikzimage,因为我希望它和页面一样宽,而且我认为边缘标签会有更多空间。但这似乎仍然没有解决问题。我还遇到了红色箭头的问题。我想将其放在图表之外而不是同一方向,但我似乎无法弄清楚如何更改弧形属性以使其看起来不错。

现在看起来像:

在此处输入图片描述

我使用的代码是这样的:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{arrows,shapes,decorations,automata,backgrounds,petri}
\begin{document}

\begin{tikzpicture}[scale=1.8]

\begin{scope}[every node/.style={circle,thick,draw}]
    \node (A) at (0,3) {A};
    \node (B) at (3,3) {B};
    \node (C) at (6,3) {C};
    \node (D) at (6,0) {D};
    \node (E) at (6,-3) {E};
    \node (F) at (3,-3) {F};
    \node (G) at (0,-3) {G};
    \node (H) at (0,0) {H};
\end{scope}

\begin{scope}[>={Stealth[black]},
              every node/.style={fill=white,circle},
              every edge/.style={draw=black}]

    \draw [red,-] (A.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (A);
    \path [-] (A) edge node {$xx$} (B);
    \path [-] (A) edge[bend left=60] node {$xx$} (C);
    \path [-] (A) edge node {$xx$} (D);
    \path [-] (A) edge node {$xx$} (E);
    \path [-] (A) edge node {$xx$} (F);
    \path [-] (A) edge[bend right=60] node {$xx$} (G);
    \path [-] (A) edge node {$xx$} (H);

    \draw [red,-] (B.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (B);
    \path [-] (B) edge node {$xx$} (C);
    \path [-] (B) edge node {$xx$} (D);
    \path [-] (B) edge node {$xx$} (E);
    \path [-] (B) edge node {$xx$} (F);
    \path [-] (B) edge node {$xx$} (G);
    \path [-] (B) edge node {$xx$} (H);

    \draw [red,-] (C.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (C);
    \path [-] (C) edge node {$xx$} (D);
    \path [-] (C) edge[bend left=60] node {$xx$} (E);
    \path [-] (C) edge node {$xx$} (F);
    \path [-] (C) edge node {$xx$} (G);
    \path [-] (C) edge node {$xx$} (H);

    \draw [red,-] (D.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (D);
    \path [-] (D) edge node {$xx$} (E);
    \path [-] (D) edge node {$xx$} (F);
    \path [-] (D) edge node {$xx$} (G);
    \path [-] (D) edge node {$xx$} (H);

    \draw [red,-] (E.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (E);
    \path [-] (E) edge node {$xx$} (F);
    \path [-] (E) edge[bend left=60] node {$xx$} (G);
    \path [-] (E) edge node {$xx$} (H);

    \draw [red,-] (F.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (F);
    \path [-] (F) edge node {$xx$} (G);
    \path [-] (F) edge node {$xx$} (H);

    \draw [red,-] (G.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (G);
    \path [-] (G) edge node {$xx$} (H);

    \draw [red,-] (H.90) arc (0:264:4mm) node[pos=0.2,above left] {$xx$} (H);

\end{scope}

\end{tikzpicture}
\end{document}

相关内容