Zeichnen Sie dieses Diagramm in Tikz (mit negativen Achsen)

Zeichnen Sie dieses Diagramm in Tikz (mit negativen Achsen)

Ich versuche mit Tikz folgende Abbildung zu erzeugen:

Bildbeschreibung hier eingeben

Mein bester Versuch führt mich jedoch zu Folgendem (was nicht ganz das ist, was ich will):

Bildbeschreibung hier eingeben

Hier ist ein MWE (es gibt einige Texte, die anders sind, aber darum geht es in der Frage nicht):

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{fit, calc, matrix, positioning, arrows, intersections, through, backgrounds, patterns}

\begin{document}
\begin{figure}[!htb]
\centering
\begin{tikzpicture}[my plot/.style={thick, smooth, samples=100, domain=0:1}, my grid/.style={densely dotted,opacity=0.5, every node/.style={black,opacity=1}}, my axis/.style={latex-latex},scale=0.75]
\coordinate (start plot) at (0,{(0)});
\coordinate (end plot) at (4,{(4)});
\draw[my axis] ([shift={(-0cm,0cm)}]start plot |- end plot) node[above] {$h_2$} |- node[coordinate](origin){} ([shift={(0cm,-0cm)}]start plot -| end plot) node[right] {$h_1$};
\def\x{0.5}\def\y{4}\def\p{0.55}
\coordinate (Ux) at (4.5,{(0)});
\coordinate (Uy) at (0,{(1.5)});
\coordinate (Ua) at (0,{(6)});
\coordinate (Ub) at (6,{(0)});
\coordinate (Uc) at (3,{(0)});
\coordinate (Ud) at (0,{(3)});
\coordinate (Ue) at (1.5,{(0)});
\coordinate (Uf) at (0,{(4.5)});
\coordinate (Ug) at (0,{(0)});
\coordinate (Uh) at (4.5,{(4.5)});
\coordinate (Ui) at (2,{(2)});
\coordinate (Uj) at (1.5,{(1.5)});
\coordinate (Uk) at (3,{(3)});
\coordinate (Ul) at (1.5,{(4)});
\coordinate (Um) at (4,{(1.5)});
\draw[my grid] (Uy) |- node[left,font=\scriptsize]{$1$} cycle;
\draw[my grid] (Uc) |- node[below,font=\scriptsize]{$2$} cycle;
\draw[my grid] (Ud) |- node[left,font=\scriptsize]{$2$} cycle;
\draw[my grid] (Ue) |- node[below,font=\scriptsize]{$1$} cycle;
\draw[fill] (Ug) circle (2pt);
\draw[fill] (Uj) circle (2pt);
\draw[fill] (Uk) circle (2pt);
\node [below] at (Ug) {\footnotesize{$h(T,R)=H(B,L)$}};
\node [below, xshift=10pt] at (Uj) {\footnotesize{$h(T,L)$}};
\node [right] at (Uk) {\footnotesize{$h(B,R)$}};
\node [left] at (Uj) {\footnotesize{$C(G)$}};
\draw[-] (Uj) -- (Ug);
\draw[-] (Uk) -- (Uj);
\draw[-] (Uj) -- (Ul);
\draw[-] (Uj) -- (Um);
\end{tikzpicture}
\end{document}

Mein Hauptproblem hier ist, dass ich buchstäblich keine Ahnung habe, wie ich das Diagramm mit negativen x- und y-Achsen bekomme. Kann mir jemand helfen, das gewünschte Ergebnis zu erzielen?

Danke euch allen!

Antwort1

Hier ist ein kleiner Code mit einer ähnlichen Zeichnung. Ich habe die Schriftart nicht geändert, da ich ihren Namen nicht kenne.

\documentclass{article}

\usepackage{tikz}

\begin{document}

    \begin{tikzpicture}[scale = 2]
    % axis drawing
    \draw [->] (0,-2) -- (0,2);
    \draw [->] (-2,0) -- (2,0);

    \node[below] at (-1,0) {$-1$};
    \node[below] at (1,0) {$1$};
    \node[left] at (0,-1) {$-1$};
    \node[left] at (0,1) {$1$};
    \node[right] at (2,0) {$h_1$};
    \node[above] at (0,2) {$h_2$};

    % diagonal drawing
    \draw[thick] (-1,1) -- (1,-1);
    \draw[fill] (-1,1) circle [radius=0.05];
    \draw[fill] (1,-1) circle [radius=0.05];

    \node[below right] at (1,-1) {$h(H,H) = h(T,T)$};
    \node[above left] at (-1,1) {$h(T,H) = h(H,T)$};
    \node[below] at (-1,0.7) {$C(G)$};

    % axis 2 drawing
    \draw (1,2.1) -- (1,1) -- (2.1,1);
    \node[right] at (2.1,1) {$R_2=1$};
    \node[above] at (1,2.1) {$R_1=1$};

    \end{tikzpicture}

\end{document}

grafische Zeichnung

Antwort2

Ich muss gestehen, dass ich in Ihrem MWE nicht weiterkam ... daher konnte ich nicht herausfinden, wo Sie Fehler bei der Positionierung der Bildelemente machen. Stattdessen habe ich das gegebene Bild von Grund auf neu gezeichnet (keine große Sache, es ist ziemlich einfach):

\documentclass [tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows}
\usepackage{sansmath}

\begin{document}
    \begin{tikzpicture}[
every node/.style = {font=\sansmath, color=blue!70!black}
TL/.append style = {font=\sffamily\scriptsize}% TL: Tick Labels
                        ]
% axis
\draw[->] (-3,0)   -- (3,0) node[right] {$h_1$};
\draw[->] (0,-2.5) -- (0,3) node[above] {$h_2$};
% tick
\foreach \i in {-2,-1,1,2}
    \draw (\i,2pt) -- ++ (0,-4pt)   node[TL,below] {\i}
          (2pt,\i) -- ++ (-4pt,0)   node[TL, left] {\i};
% curve (line)
\draw[thick,*-*]    (-1,1) node[left]  {$h(T,H)=h(H,T)$}
                --  (1,-1) node[right] {$h(H,H)=h(T,T)$};       
% R coordinate system?
\draw   (1,2) node[above]  {$R_1=1$}
    |-  (2,1) node[right]  {$R_2=1$};
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen