Tikz: Text nicht in Tikz-Boxen zentriert

Tikz: Text nicht in Tikz-Boxen zentriert

Ich versuche, mit dem Tikzpicture-Paket (Mathcha) ein Flussdiagramm zu erstellen. Warum ist der Text in den Tikz-Boxen nicht zentriert? Vielen Dank im Voraus.

\begin{figure}[ht]
\vspace{4ex}
\centering
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,634); %set diagram left start at 0, and has height of 634

%Shape: Rectangle [id:dp08909796923277336] 
\draw  [line width=1.5]  (51,41) -- (609,41) -- (609,81) -- (51,81) -- cycle ;
%Shape: Rectangle [id:dp293971635997501] 
\draw  [line width=1.5]  (210,359.72) -- (520,359.72) -- (520,401.3) -- (210,401.3) -- cycle ;
%Shape: Rectangle [id:dp015112508692092352] 
\draw  [line width=1.5]  (190,210.2) -- (310,210.2) -- (310,250) -- (190,250) -- cycle ;
%Shape: Rectangle [id:dp9224449615071879] 
\draw  [line width=1.5]  (490,209.82) -- (610,209.82) -- (610,250.13) -- (490,250.13) -- cycle ;
%Straight Lines [id:da2085806199614264] 
\draw [line width=1.5]    (550,249.95) -- (550,379.8) -- (525,380.07) ;
\draw [shift={(521,380.12)}, rotate = 359.37] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Straight Lines [id:da6918276956657493] 
\draw [line width=1.5]    (180,81.59) -- (180,149.45) ;
%Straight Lines [id:da8143556798116779] 
\draw [line width=1.5]    (110,250.35) -- (110,310.21) -- (250,310.01) -- (250,249.93) ;
%Straight Lines [id:da6498353350246521] 
\draw [line width=1.5]    (180,310.11) -- (180,379.97) -- (205,380.35) ;
\draw [shift={(209,380.42)}, rotate = 180.89] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Shape: Rectangle [id:dp6903312621520653] 
\draw  [line width=1.5]  (50,210.2) -- (170,210.2) -- (170,250) -- (50,250) -- cycle ;
%Straight Lines [id:da6819495654480933] 
\draw [line width=1.5]    (110,209.57) -- (110,149.57) -- (250,149.68) -- (250,209.87) ;
%Straight Lines [id:da4777805352746255] 
\draw [line width=1.5]    (400,81.72) -- (400,205.1) ;
\draw [shift={(400,209.1)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Straight Lines [id:da6994702521621938] 
\draw [line width=1.5]    (480,310.37) -- (480,354.55) ;
\draw [shift={(480,358.55)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Straight Lines [id:da5755824703070298] 
\draw [line width=1.5]    (400,250.37) -- (400,354.55) ;
\draw [shift={(400,358.55)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Straight Lines [id:da11378713626826986] 
\draw [line width=1.5]    (550,81.72) -- (550,205.1) ;
\draw [shift={(550,209.1)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;
%Shape: Rectangle [id:dp2737101017997946] 
\draw  [line width=1.5]  (340,209.82) -- (460,209.82) -- (460,250.13) -- (340,250.13) -- cycle ;
%Shape: Rectangle [id:dp04718661092413878] 
\draw  [line width=1.5]  (430,270.07) -- (530,270.07) -- (530,309.88) -- (430,309.88) -- cycle ;
%Straight Lines [id:da40081723928825497] 
\draw [line width=1.5]    (400,290.1) -- (425,290.1) ;
\draw [shift={(429,290.1)}, rotate = 180] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (11.61,-5.58) -- (0,0) -- (11.61,5.58) -- cycle    ;

% Text Node
\draw (181,52) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {High Position on Alphabetically Ordered List};
% Text Node
\draw (348,222) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Higher Visibility};
% Text Node
\draw (445,281) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Familiarity};
% Text Node
\draw (57,222.18) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Status quo bias};
% Text Node
\draw (251,371.18) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Higher Trading Activity + Liquiditiy};
% Text Node
\draw (495,222) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Superior Quality};
% Text Node
\draw (215,222.18) node [anchor=north west][inner sep=0.75pt]  [font=\normalsize] [align=center] {Satisficing};

\end{tikzpicture}
\end{figure}

Bildbeschreibung hier eingeben

Antwort1

Der Grund, warum der Text in den Knoten nicht zentriert ist, liegt eigentlich darin, dass das, was wie Knoten aussieht (die schwarzen Rechtecke), tatsächlich nur schwarze Rechtecke sind. Der Text wird dann später mithilfe von Knoten positioniert, die keine Ränder haben. Leider sind diese Knoten nicht richtig in der Mitte der Rechtecke positioniert.

Ich würde empfehlen, dass Sie diese schreckliche Ausgabe, die von einer Software erzeugt wird, nicht verwenden, sondern stattdessen versuchen zu verstehen, wie man mit Ti umgehtkZ und zeichne das selbst. Ich weiß, dass die TikDas Z/PGF-Handbuch ist umfangreich und einschüchternd, enthält aber auch einige nette Tutorials, die die grundlegenden Dinge gut erklären. Gehen Sie es einfach langsam an, es zahlt sich wirklich aus und Sie werden schnell mit der Syntax vertraut.

Das gezeigte Diagramm könnte wie folgt dargestellt werden:

\documentclass[border=10pt]{standalone} 
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[
    x=1.75cm,
    y=1.75cm,
    line width=1pt,
    >=latex,
    every node/.style={
        rectangle,
        draw,
        inner ysep=10pt,
        text width=3cm,
        align=center,
    },
    narrow/.append style={
        text width=2cm,
    },
    wide/.append style={
        text width=7cm,
    },
    very wide/.append style={
        text width=13.5cm,
    },
]

\node[very wide] at (0,0) (a1) {\textbf{High Position on Alphabetically Ordered List}};

\node at (-3,-2) (b1) {Status quo bias};
\node at (-1,-2) (b2) {Satisficing};
\node at (1,-2) (b3) {Higher Visibility};
\node at (3,-2) (b4) {Superior Quality};

\node[narrow] at (2,-2.75) (c1) {Familiarity};

\node[wide] at (0.5,-4) (d1) {\textbf{Higher Trading Activity $+$ Liquidity}};

\draw (-2,-1 |- a1.south) -- (-2,-1);
\draw (-2,-1) -| (b1.north);
\draw (-2,-1) -| (b2.north);

\draw (b1.south) |- (-2,-3);
\draw (b2.south) |- (-2,-3);
\draw[->] (-2,-3) |- (d1.west);

\draw[->] (b3.north |- a1.south) -- (b3.north);
\draw[->] (b4.north |- a1.south) -- (b4.north);

\draw[->] (b3.south) -- (b3.south |- d1.north);
\draw[->] (b3.south |- c1.west) -- (c1.west);
\draw[->] (c1.south) -- (c1.south |- d1.north);
\draw[->] (b4.south) |- (d1.east);

\end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen