TeX - LaTeX Asked on November 9, 2020
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}
However I would like it to look more like:
How can I add the shading and change the arrow heads to be like the second image?
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
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}
Correct answer by js bibra on November 9, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP