I want to modify the image (see code below)
by shading in the regions formed by the dashed lines that contain a black dot. The goal is to obtain something like
How can I shade these regions?
Code for image:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\begin{document}
\tikzstyle{open} = [draw, black, fill=white, shape=circle]
\tikzstyle{closed} = [draw, fill, shape=circle]
\tikzstyle{invisibleVertex} = [shape=circle]
\tikzstyle{invisibleEdge} = [draw opacity=0]
\begin{tikzpicture}[scale=1,transform shape,node distance=2.5cm,>=open triangle 60,semithick]
\node[closed] (0) {};
\node[closed] (1) [right of=0] {};
\node[closed] (2) [below of=1] {};
\node[closed] (3) [left of=2] {};
\path (0) edge node[open] (m0) {} (1)
(1) edge node[open] (m1) {} (2)
(2) edge node[open] (m2) {} (3)
(3) edge node[open] (m3) {} (0);
\path (m0) edge[->, densely dashed] (m1)
edge[<-, densely dashed, out= 45, in= 45, looseness=3, overlay] node[invisibleVertex] (e0) {} (m1)
(m1) edge[->, densely dashed] (m2)
edge[<-, densely dashed, out= -45, in= -45, looseness=3, overlay] node[invisibleVertex] (e1) {} (m2)
(m2) edge[->, densely dashed] (m3)
edge[<-, densely dashed, out=-135, in=-135, looseness=3, overlay] node[invisibleVertex] (e2) {} (m3)
(m3) edge[->, densely dashed] (m0)
edge[<-, densely dashed, out= 135, in= 135, looseness=3, overlay] node[invisibleVertex] (e3) {} (m0);
\node[invisibleVertex, below=0cm of e0] {};
\node[invisibleVertex, left =0cm of e1] {};
\node[invisibleVertex, above=0cm of e2] {};
\node[invisibleVertex, right=0cm of e3] {};
\end{tikzpicture}
\end{document}
Best Answer
It's always complex to do a lot of things at the same time. I searched a trick because there is little bug if I use
open triangle 60
. The path is not exactly the same. Look at this picture to see the problem (same code as below but with open triangle 60)Perhaps it's possible to use a simpler way. The problem with
edge
is we don't get a closed path .You can compare
with
It's possible to use
foreach
to write a shorter code.Without
open triangle
it's possible to do :Update : I defined a new arrow because it' seems that the definition of
open triangle' is wrong. I defined
new open triangle 60`.Update and remark
Finally there are some adverse side effects with the actual solution. For example :
With
triangle 60
andnew open triangle 60
the tips are misplaced but the lines are correct. Finally withopen triangle 60
the tips are well placed but the lines are incorrect.I don't know if it's easy to modify the definition of the arrows to get correct positions for the tips and the lines.
A possibility like mwibrow wrote it's to use the decoration library. The next code is an adaptation.