2

I am plotting a graph. Here is a MWE:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{default}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[shape=circle,draw=black] (A) at (0,2) {A};
\node[shape=circle,draw=black] (B) at (0,0) {B};
\path (A) edge [loop above] node {} (A);
\path (B) edge   [->]           node[above] {} (A);
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

However I would like it to look more like:

nodes with shading

How can I add the shading and change the arrow heads to be like the second image?

Simd
  • 6,785
  • 1
    for the type of arrows please see - - https://tex.stackexchange.com/questions/5461/is-it-possible-to-change-the-size-of-an-arrowhead-in-tikz-pgf -- there is such a wide variety to select from so I have not changed the arrows in my answer below – js bibra Jul 29 '20 at 09:57
  • 1
    please see the edit to the answer also – js bibra Jul 29 '20 at 10:12

1 Answers1

3

enter image description here

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, shadows}%<---------------add shadow
%\usepackage{default}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[shape=circle,draw=black,fill=white, drop shadow] (A) at (0,2) {A};
\node[shape=circle,draw=black,fill=white, drop shadow] (B) at (0,0) {B};
\path (A) edge [loop above] node {} (A);
\path (B) edge   [->]           node[above] {} (A);
\end{tikzpicture}
\end{frame}
\end{document}

EDIT -- for better control over shading

enter image description here

You can also have better control over the color shading by adding the following line to the options of any node in []

drop shadow={top color=green,
                bottom color=yellow!40,
                shadow xshift=4pt,
                shadow yshift=-4pt,}

Similarly the xshift and yshift give more precise control over the shadow placement

An example is reproduced below--- note-- the shadows can be applied to arrows also

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, shadows, shadows.blur}
%\usepackage{default}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\node[shape=circle,
        draw=black,
        fill=white, 
        drop shadow={top color=blue,
                    bottom color=blue!40,
                    shadow xshift=2pt,
                    shadow yshift=-2pt,}, 
%       blur shadow={shadow blur steps=1}
        ] 
        (A) at (0,2) {A};
\node[shape=circle,
        draw=black,
        fill=white, 
        drop shadow={top color=green,
                    bottom color=yellow!40,
                    shadow xshift=4pt,
                    shadow yshift=-4pt,}, 
%       blur shadow={shadow blur steps=1}
    ]  
        (B) at (0,0) {B};
\path (A) edge [loop above] node {} (A);
\path (B) edge   [->]           node[above] {} (A);
\end{tikzpicture}
\end{frame}
\end{document}
js bibra
  • 21,280