2

I have ellipses with hatch. I want to use lines or bricks hatch but more rare than default.

I can change spread between lines in this way Custom and built in TikZ fill patterns. It worked, but it's so ugly and I don't know how to scale bricks.

I tried to do so https://tex.stackexchange.com/a/125545/53834, but it didn't help -- hatch adapts to new scale.

So, my image is

\documentclass{standalone}    
\usepackage{pgfplots}
\usetikzlibrary{patterns}

\begin{document}
  % defining the new dimensions
  \newlength{\hatchspread}
  \newlength{\hatchthickness}
  % declaring the keys in tikz
  \tikzset{hatchspread/.code={\setlength{\hatchspread}{#1}},
           hatchthickness/.code={\setlength{\hatchthickness}{#1}}}
  % setting the default values
  \tikzset{hatchspread=.5cm,
           hatchthickness=0.4pt}
  % declaring the pattern
  \pgfdeclarepatternformonly[\hatchspread,\hatchthickness]% variables
     {custom north west lines}% name
     {\pgfqpoint{-2\hatchthickness}{-2\hatchthickness}}% lower left corner
     {\pgfqpoint{\dimexpr\hatchspread+2\hatchthickness}{\dimexpr\hatchspread+2\hatchthickness}}% upper right corner
     {\pgfqpoint{\hatchspread}{\hatchspread}}% tile size
     {% shape description
      \pgfsetlinewidth{\hatchthickness}
      \pgfpathmoveto{\pgfqpoint{0pt}{\hatchspread}}
      \pgfpathlineto{\pgfqpoint{\dimexpr\hatchspread+0.15pt}{-0.15pt}}
      \pgfusepath{stroke}
     }
  \begin{tikzpicture}
    \draw[pattern=custom north west lines] (-2,0) ellipse (1cm and 2cm);
    \draw (2,0) ellipse (.7cm and 1.5cm);
  \end{tikzpicture}
\end{document}

I include it this way

\begin{figure}[h!]
  \center\includestandalone[width=4cm]{tikz/indistinguishableValuesImage}
\end{figure}

I want to get more elegant solution for more rare hatch, or scale it normally (with hatch scaling). And I don't want to make it PNG -- I want to use vector graphics or, if nothing will help, SVG.

  • 3
    Your first link is actually one of weird sites that hijack Stackexchange questions and answers, I've included the original in your question. – percusse Sep 28 '14 at 10:31

Your Answer

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

Browse other questions tagged or ask your own question.