다이어그램에서 사각형을 원으로 변경하려고 합니다.

다이어그램에서 사각형을 원으로 변경하려고 합니다.

원이 있는 1D 구획 다이어그램을 만들려고 하는데 원이 있는 tikzstyle을 변경해도 사각형에서 원으로 변경되지 않습니다.

\documentclass[12pt]{report}
\usepackage{caption}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\tikzstyle{int}=[draw, line width = 0.5mm, minimum size=5em]
\tikzstyle{make circle}=[circle, line width = 0.5 mm, minimum size=5em]

\begin{figure} 
\centering

\begin{tikzpicture}[node distance=3cm,auto,>=latex']

\node [int] (a) {};

%%%%%%%%%%%%%
\node [makecircle] (c) [] {$M$}; %% This is the problem (still makes a square)
%%%%%%%%%%%

\node [int] (d) [right of=c, node distance=4cm] {$E$};

\draw[->, ultra thick, blue] (c) edge node {$r(1-p)$} (d);

\draw [green, ultra thick, ->] 
    ([xshift=-0.25cm]a.north) to[out=120, in=60, distance=1.5cm] ([xshift=0.25cm]a.north);
\node [above=1.0cm,text=green] at (a.north) {$pr$};
\draw [red, ultra thick, ->] (0,-1) -- (0,-2);
\node [right=0.5cm,below=0.15cm,text=red] at (a.south) {$\approx 0$};

\end{tikzpicture}
\caption{This is a two compartment model}

\end{figure}

\end{document}

답변1

(여기에는 정의된 원이 없음) 을 사용하여 원을 그리지 만 ( 여기에는 없음 ) \node [int] (a) {};을 사용하여 텍스트 M을 씁니다 ( 대신 썼습니다 .)\node [makecircle] (c) [] {$M$};drawmakecirclemake circle

make circle만 추가하므로 tikzstyle circle을 제거하고 int스타일을 재사용했습니다.

\documentclass[12pt]{report}
\usepackage{caption}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\tikzstyle{int}=[draw, line width = 0.5mm, minimum size=5em]

\begin{figure} 
\centering

\begin{tikzpicture}[node distance=3cm,auto,>=latex']
    \node[int, circle] (c) [] {$M$};

    \node [int] (d) [right of=c, node distance=4cm] {$E$};

    \draw[->, ultra thick, blue] (c) edge node {$r(1-p)$} (d);

    \draw [green, ultra thick, ->] 
        ([xshift=-0.25cm]c.north) to[out=120, in=60, distance=1.5cm] ([xshift=0.25cm]c.north);
    \node [above=1.0cm,text=green] at (c.north) {$pr$};
    \draw [red, ultra thick, ->] (0,-1) -- (0,-2);
    \node [right=0.5cm,below=0.15cm,text=red] at (c.south) {$\approx 0$};
\end{tikzpicture}
\caption{This is a two compartment model}

\end{figure}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보