1

Although the header looks similar to this question, we could not find anything related to what we want in that answer. we would like to thatch shade a portion of a graph ( graphs with vertices and edges) like in this photo here, thatched shadding We have drawn the graphs using Tkiz like this, The Tkiz graphs. Now we would like to shade various portions of the graph (regions made of square tile-like shapes ), sometime the shadings would overlap so it would be nice if we can choose various angles for the thatches or various densities of the thatching. Thanks in advance for a pointer.

The following is what we have right now,

  \usepackage{tikz}
\usepackage{fullpage}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[scale=.15]
    
        \draw (6,0)--(4,2)--(6,4)--(8,2)--(6,0);
        \draw [dotted] (6,4)--(8,6);
        \draw [dotted] (8,2)--(10,4);
        \draw (12,10)--(10,8)--(12,6)--(10,4);
        \draw (10,8)--(8,10)--(10,12);
        \draw [dotted](10,12)--(12,14);
        \draw [dotted](12,10)--(14,12);
        \draw (12,14)--(14,16)--(16,18)--(18,16)--(16,14)--(18,12)--(16,10)--(14,12)--(12,14);
        \draw (14,8)--(12,10)--(10,12);
        \draw (16,10)--(14,12)--(12,14);
        \draw (12,6)--(14,8);
        \draw [dotted](14,8)--(16,10);
        \draw (10,4)--(8,6)--(10,8);
        \draw (14,12)--(16,14)--(14,16);
        \draw [dotted](16,18)--(18,20);
        \draw (18,20)--(20,22)--(22,20)--(20,18)--(18,20);
        \draw [dotted](18,16)--(20,18); 
         \draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=.5pt}, yshift=0pt](6.5,-.5)--(12.5,5.5) node [black,midway,xshift=0.5 cm]{\footnotesize $m$};
        \draw [decorate,decoration={brace,amplitude=5pt},xshift=-4pt, yshift=0pt](7.5,10.5)--(13.5,16.5) node [black,midway,xshift=-.5 cm]{\footnotesize $k$};
        \draw [decorate,decoration={brace,amplitude=5pt},xshift=-4pt, yshift=0pt](13.5,16.5)--(19.5,22.5) node [black,midway,xshift=-.5 cm]{\footnotesize $n$}; 

        \begin{scriptsize}

        \fill [color=black] (6,0) circle (4 pt);
        \fill [color=black] (4,2) circle (4 pt);
        \fill [color=black] (8,2) circle (4 pt);
        \fill [color=black] (6,4) circle (4 pt);
        \fill [color=black] (10,4) circle (4 pt);
        \fill [color=black] (8,6) circle (4 pt);
        \fill [color=black] (12,6) circle (4 pt);
        \fill [color=black] (10,8) circle (4 pt);
        \fill [color=black] (8,10) circle (4 pt);
        \fill [color=black] (14,8) circle (4 pt);
        \fill [color=black] (12,10) circle (4 pt);
        \fill [color=black] (10,12) circle (4 pt);
        \fill [color=black] (16,10) circle (4 pt);
        \fill [color=black] (14,12) circle (4 pt);
        \fill [color=black] (12,14) circle (4 pt);
        \fill [color=black] (18,12) circle (4 pt);
        \fill [color=black] (16,14) circle (4 pt);
        \fill [color=black] (14,16) circle (4 pt);
        \fill [color=black] (18,16) circle (4 pt);
        \fill [color=black] (16,18) circle (4 pt);
        \fill [color=black] (20,18) circle (4 pt);
        \fill [color=black] (18,20) circle (4 pt);
        \fill [color=black] (22,20) circle (4 pt);
        \fill [color=black] (20,22) circle (4 pt);
        \end{scriptsize}
        \end{tikzpicture}

    
6
  • What you try so far? So far your question is "do-this-instead-me" and will be probably closed as needs details or clarity" . BTW, for shading you can use fill=<selected color>.
    – Zarko
    May 15, 2021 at 7:36
  • If you defined your square by using nodes you can refer to them to fill those squares with patterns.meta library. It would be easier if you procided your original code for the picture above. In this case, we could come with improvements you ask for.
    – SebGlav
    May 15, 2021 at 10:09
  • @Zarko, I understand, I should've added the code. Thanks. May 15, 2021 at 17:16
  • @SebGlav, I do not know how to use the patterns.meta, I will check. Thanks. May 15, 2021 at 17:17
  • 1
    @SebGlav, thank you. I accepted that answer. It is what I wanted, a pointer so that I can explore and fit it for my purpose. May 18, 2021 at 6:10

1 Answer 1

2

Like this?

enter image description here

MWE is:

\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns.meta,
                decorations.pathreplacing,
                    calligraphy,% had to be after decorations.pathreplacing
                positioning
                }

\begin{document}
    \begin{tikzpicture}[
node distance=0mm and 10mm,
BC/.style = {
        decorate,
        decoration={calligraphic brace, amplitude=2mm,
        pre =moveto, pre  length=1pt,
        post=moveto, post length=1pt,
        raise=2mm, #1},
        thick,
        pen colour={black}
        },
dot/.style= {circle, fill, inner sep=1pt, node contents={}},
RN/.style = {draw, minimum size=1cm, outer sep=0pt, 
             node contents={}},
PN/.style = {pattern={Lines[angle=15,distance={3pt},line width=0.2pt]},
             pattern color=gray}
                ]
    \begin{scope}[transform shape, rotate=45]
\node (m1) [RN] {}; 
\node (m2) [RN, right=of m1];
\node (m3) [RN, PN, right=0mm of m2];
\node (m4) [RN, PN, right=of m3];
\node (m5) [RN, PN, above=of m3];
\node (m6) [RN, PN, right=of m5];
\node (m7) [RN, right=0mm of m6];
\node (m8) [RN, right=of m7];
%
\foreach \i [evaluate=\i as \j using int(\i+1)] in {1,3,5,7}
\draw[densely dashed]   (m\i.north east) -- (m\j.north west)
                        (m\i.south east) -- (m\j.south west);
%
\foreach \i in {1,2,...,8}
\path   (m\i.north west)    node[dot]
        (m\i.north east)    node[dot]
        (m\i.south east)    node[dot]
        (m\i.south west)    node[dot];
    \end{scope}
\draw[BC=mirror]    (m1.south west) -- node[below=4mm, sloped] {$m$} (m2.south east);
\draw[BC]           (m5.north west) -- node[above=4mm, sloped] {$k$} (m6.north east);
\draw[BC]           (m7.north west) -- node[above=4mm, sloped] {$n$} (m8.north east);
    
    \end{tikzpicture}
\end{document0}

As you can observe, code is significantly rewritten. Instead of drawing lines, it used nodes, which are drawn in horizontal direction and when completed rotated for 45 degree.

For shading is used patterns.metta (as suggested in @SebGlaw in his comment). For it proces is defined special style, where are define angle of lines, lines thickness and distance between them.

Additional care is given to drawn braces, which are drawn by use of the calligraphy package.

1
  • 1
    Thank you for the help, owing to a huge storm that took the power lines out for three days and counting. I could not reply in time. May 18, 2021 at 6:08

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.