0

I have the following code where Im trying to draw a graph. I want the P and M nodes to be ellipses(oval shaped), but they just come out as circles. Im aware that an ellipse is a special case of a circle, but I don't know know how to specify the radii (writing ellipse(0.5 and 0.7) for instance didn't work).


\begin{tikzpicture}[node distance=2cm, minimum size = 1cm]

\node[rectangle,draw = black] (B) at (-1,4) {$B$};

\node[ellipse,draw = black] (M) at (-1,1) {$M$};

\node[ellipse,draw = black] (P) at (0.5,2.5) {$P$};

\node[diamond, draw = black] (U) at (1,5.5) {$U$};

\draw[->] (B) -- (M);

\draw[->] (B) -- (P);

\draw[->] (B) -- (U);

\draw[->] (M) -- (P);

\draw[->] (P) -- (U);








\end{tikzpicture}

enter image description here

2

A circle is an ellipse, so your code is not wrong.
Nevertheless, if you want your node to be in ellipse shape, you can either insert a longer text in it (like "Power" in the example below), or ask your node to have a minimum width (like for the M node below).

(not related, but you didn't provide a Minimum Working Example, which is a better way to ask for answers)

\documentclass[tikz,border=3.14159mm]{standalone}
\usetikzlibrary{shapes}
\begin{document}


\begin{tikzpicture}[node distance=2cm, minimum size = 1cm]

\node[rectangle,draw = black] (B) at (-1,4) {$B$};
\node[ellipse, minimum width=2cm,draw = black] (M) at (-1,1) {$M$};
\node[ellipse,draw = black] (P) at (0.5,2.5) {$Power$};
\node[diamond, draw = black] (U) at (1,5.5) {$U$};

\draw[->] (B) -- (M);
\draw[->] (B) -- (P);
\draw[->] (B) -- (U);
\draw[->] (M) -- (P);
\draw[->] (P) -- (U);

\end{tikzpicture}

\end{document}

ellipse shape node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.