Hatch directionHatch a rectangle in TikZHatch a rectangle in TikZHow to scale hatch in tikz figure in...
Why can't I see bouncing of a switch on an oscilloscope?
How can bays and straits be determined in a procedurally generated map?
Is it possible to make sharp wind that can cut stuff from afar?
Is the language {<p,n> | p and n are natural numbers and there's no prime number in [p,p+n]} belongs to NP class?
Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).
A Journey Through Space and Time
I probably found a bug with the sudo apt install function
Do any Labour MPs support no-deal?
Today is the Center
When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?
Do Phineas and Ferb ever actually get busted in real time?
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
Why is "Reports" in sentence down without "The"
How is it possible to have an ability score that is less than 3?
"You are your self first supporter", a more proper way to say it
Type 1 Error & Type 2 Error's pregnancy test analogy: is it legit?
Why was the small council so happy for Tyrion to become the Master of Coin?
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
What would happen to a modern skyscraper if it rains micro blackholes?
Download, install and reboot computer at night if needed
Is there really no realistic way for a skeleton monster to move around without magic?
Why is an old chain unsafe?
If I cast Expeditious Retreat, can I Dash as a bonus action on the same turn?
N.B. ligature in Latex
Hatch direction
Hatch a rectangle in TikZHatch a rectangle in TikZHow to scale hatch in tikz figure in LaTeX?custom hatching pattern : arbitrary direction of hatchingHow to use hatch pattern in baposter header box?how to change direction of arrow tikzHow to hatch pie charts in Tikz pgf?changing the text direction in TikZ diagram
I want to modify the hatch lines direction marked in red of the next diagram:
It was obtained with the next code:
documentclass[letterpaper,11pt]{report}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{float}
usepackage[none]{hyphenat}
usepackage{array}
usepackage{graphicx}
usepackage{pgfplots}
pgfplotsset{width=15cm,compat=1.9}
usepgfplotslibrary{fillbetween}
usetikzlibrary{patterns,arrows,fit,matrix,arrows.meta,calc,decorations.pathmorphing,decorations.markings,decorations.pathreplacing}
usepackage{tikz}
usepackage{bigstrut}
usepackage{float}
usepackage{bbding}
usepackage{diagbox}
usepackage{scalerel}
letsavestarstar
renewcommandstar{{scalerel*{bigstar}{savestar}}}
allowdisplaybreaks
usepackage[resetlabels,labeled]{multibib}
usepackage{url}
usepackage{subcaption}
usepackage{cite}
usepackage{multirow}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ltablex}
usepackage{mathrsfs}
usepackage{rsfso}
usepackage{booktabs}
usepackage{mathtools}
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north west lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexprhatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{-0.15pt}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{hatchshift}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{-0.15pt}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{figure}[ht]
centering
begin{tikzpicture}
draw (0,0) ellipse (5.375cm and 1.5cm);
draw (-5.375,-0.5) arc (180:360:5.375 and 1.5);
draw (-5.375,0) -- ++(0,-0.5);
draw (5.375,0) -- ++(0,-0.5);
draw (0,0) ellipse (2.685cm and 0.75cm);
draw (2.6,-0.2) arc (19:165:2.7 and 0.75);
draw (1.5,0) -- (2.7,0);
draw (-2.7,0) -- (-1.5,0);
draw (0,0.75) -- (0,0.2);
draw (0,-0.75) -- (0,-0.2);
draw (1.7,0.6) -- (0.7,0.2);
draw (1.7,-0.6) -- (0.7,-0.2);
draw (-1.7,0.6) -- (-0.7,0.2);
draw (-1.7,-0.6) -- (-0.7,-0.2);
draw (0.8,0.7) -- (0.35,0.2);
draw (0.8,-0.7) -- (0.35,-0.2);
draw (-0.8,0.7) -- (-0.35,0.2);
draw (-0.8,-0.7) -- (-0.35,-0.2);
draw (2.4,0.3) -- (1.2,0.1);
draw (2.4,-0.3) -- (1.2,-0.1);
draw (-2.4,0.3) -- (-1.2,0.1);
draw (-2.4,-0.3) -- (-1.2,-0.1);
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
draw[pattern=custom north west lines, hatchspread=24pt, hatchcolor=black, draw=none] (2.1,-8.7) rectangle (2.685,-5.3);
draw[pattern=custom north west lines,hatchspread=25pt,hatchcolor=black,draw=none] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{figure}
end{document}
I want to change the hatch lines to something like "custom east lines", that is this direction . Any help is appreciated.
tikz-styles pattern
add a comment |
I want to modify the hatch lines direction marked in red of the next diagram:
It was obtained with the next code:
documentclass[letterpaper,11pt]{report}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{float}
usepackage[none]{hyphenat}
usepackage{array}
usepackage{graphicx}
usepackage{pgfplots}
pgfplotsset{width=15cm,compat=1.9}
usepgfplotslibrary{fillbetween}
usetikzlibrary{patterns,arrows,fit,matrix,arrows.meta,calc,decorations.pathmorphing,decorations.markings,decorations.pathreplacing}
usepackage{tikz}
usepackage{bigstrut}
usepackage{float}
usepackage{bbding}
usepackage{diagbox}
usepackage{scalerel}
letsavestarstar
renewcommandstar{{scalerel*{bigstar}{savestar}}}
allowdisplaybreaks
usepackage[resetlabels,labeled]{multibib}
usepackage{url}
usepackage{subcaption}
usepackage{cite}
usepackage{multirow}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ltablex}
usepackage{mathrsfs}
usepackage{rsfso}
usepackage{booktabs}
usepackage{mathtools}
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north west lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexprhatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{-0.15pt}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{hatchshift}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{-0.15pt}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{figure}[ht]
centering
begin{tikzpicture}
draw (0,0) ellipse (5.375cm and 1.5cm);
draw (-5.375,-0.5) arc (180:360:5.375 and 1.5);
draw (-5.375,0) -- ++(0,-0.5);
draw (5.375,0) -- ++(0,-0.5);
draw (0,0) ellipse (2.685cm and 0.75cm);
draw (2.6,-0.2) arc (19:165:2.7 and 0.75);
draw (1.5,0) -- (2.7,0);
draw (-2.7,0) -- (-1.5,0);
draw (0,0.75) -- (0,0.2);
draw (0,-0.75) -- (0,-0.2);
draw (1.7,0.6) -- (0.7,0.2);
draw (1.7,-0.6) -- (0.7,-0.2);
draw (-1.7,0.6) -- (-0.7,0.2);
draw (-1.7,-0.6) -- (-0.7,-0.2);
draw (0.8,0.7) -- (0.35,0.2);
draw (0.8,-0.7) -- (0.35,-0.2);
draw (-0.8,0.7) -- (-0.35,0.2);
draw (-0.8,-0.7) -- (-0.35,-0.2);
draw (2.4,0.3) -- (1.2,0.1);
draw (2.4,-0.3) -- (1.2,-0.1);
draw (-2.4,0.3) -- (-1.2,0.1);
draw (-2.4,-0.3) -- (-1.2,-0.1);
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
draw[pattern=custom north west lines, hatchspread=24pt, hatchcolor=black, draw=none] (2.1,-8.7) rectangle (2.685,-5.3);
draw[pattern=custom north west lines,hatchspread=25pt,hatchcolor=black,draw=none] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{figure}
end{document}
I want to change the hatch lines to something like "custom east lines", that is this direction . Any help is appreciated.
tikz-styles pattern
add a comment |
I want to modify the hatch lines direction marked in red of the next diagram:
It was obtained with the next code:
documentclass[letterpaper,11pt]{report}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{float}
usepackage[none]{hyphenat}
usepackage{array}
usepackage{graphicx}
usepackage{pgfplots}
pgfplotsset{width=15cm,compat=1.9}
usepgfplotslibrary{fillbetween}
usetikzlibrary{patterns,arrows,fit,matrix,arrows.meta,calc,decorations.pathmorphing,decorations.markings,decorations.pathreplacing}
usepackage{tikz}
usepackage{bigstrut}
usepackage{float}
usepackage{bbding}
usepackage{diagbox}
usepackage{scalerel}
letsavestarstar
renewcommandstar{{scalerel*{bigstar}{savestar}}}
allowdisplaybreaks
usepackage[resetlabels,labeled]{multibib}
usepackage{url}
usepackage{subcaption}
usepackage{cite}
usepackage{multirow}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ltablex}
usepackage{mathrsfs}
usepackage{rsfso}
usepackage{booktabs}
usepackage{mathtools}
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north west lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexprhatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{-0.15pt}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{hatchshift}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{-0.15pt}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{figure}[ht]
centering
begin{tikzpicture}
draw (0,0) ellipse (5.375cm and 1.5cm);
draw (-5.375,-0.5) arc (180:360:5.375 and 1.5);
draw (-5.375,0) -- ++(0,-0.5);
draw (5.375,0) -- ++(0,-0.5);
draw (0,0) ellipse (2.685cm and 0.75cm);
draw (2.6,-0.2) arc (19:165:2.7 and 0.75);
draw (1.5,0) -- (2.7,0);
draw (-2.7,0) -- (-1.5,0);
draw (0,0.75) -- (0,0.2);
draw (0,-0.75) -- (0,-0.2);
draw (1.7,0.6) -- (0.7,0.2);
draw (1.7,-0.6) -- (0.7,-0.2);
draw (-1.7,0.6) -- (-0.7,0.2);
draw (-1.7,-0.6) -- (-0.7,-0.2);
draw (0.8,0.7) -- (0.35,0.2);
draw (0.8,-0.7) -- (0.35,-0.2);
draw (-0.8,0.7) -- (-0.35,0.2);
draw (-0.8,-0.7) -- (-0.35,-0.2);
draw (2.4,0.3) -- (1.2,0.1);
draw (2.4,-0.3) -- (1.2,-0.1);
draw (-2.4,0.3) -- (-1.2,0.1);
draw (-2.4,-0.3) -- (-1.2,-0.1);
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
draw[pattern=custom north west lines, hatchspread=24pt, hatchcolor=black, draw=none] (2.1,-8.7) rectangle (2.685,-5.3);
draw[pattern=custom north west lines,hatchspread=25pt,hatchcolor=black,draw=none] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{figure}
end{document}
I want to change the hatch lines to something like "custom east lines", that is this direction . Any help is appreciated.
tikz-styles pattern
I want to modify the hatch lines direction marked in red of the next diagram:
It was obtained with the next code:
documentclass[letterpaper,11pt]{report}
usepackage[utf8]{inputenc}
usepackage{amsmath}
usepackage{float}
usepackage[none]{hyphenat}
usepackage{array}
usepackage{graphicx}
usepackage{pgfplots}
pgfplotsset{width=15cm,compat=1.9}
usepgfplotslibrary{fillbetween}
usetikzlibrary{patterns,arrows,fit,matrix,arrows.meta,calc,decorations.pathmorphing,decorations.markings,decorations.pathreplacing}
usepackage{tikz}
usepackage{bigstrut}
usepackage{float}
usepackage{bbding}
usepackage{diagbox}
usepackage{scalerel}
letsavestarstar
renewcommandstar{{scalerel*{bigstar}{savestar}}}
allowdisplaybreaks
usepackage[resetlabels,labeled]{multibib}
usepackage{url}
usepackage{subcaption}
usepackage{cite}
usepackage{multirow}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ltablex}
usepackage{mathrsfs}
usepackage{rsfso}
usepackage{booktabs}
usepackage{mathtools}
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north west lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexprhatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{-0.15pt}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{hatchshift}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{-0.15pt}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{figure}[ht]
centering
begin{tikzpicture}
draw (0,0) ellipse (5.375cm and 1.5cm);
draw (-5.375,-0.5) arc (180:360:5.375 and 1.5);
draw (-5.375,0) -- ++(0,-0.5);
draw (5.375,0) -- ++(0,-0.5);
draw (0,0) ellipse (2.685cm and 0.75cm);
draw (2.6,-0.2) arc (19:165:2.7 and 0.75);
draw (1.5,0) -- (2.7,0);
draw (-2.7,0) -- (-1.5,0);
draw (0,0.75) -- (0,0.2);
draw (0,-0.75) -- (0,-0.2);
draw (1.7,0.6) -- (0.7,0.2);
draw (1.7,-0.6) -- (0.7,-0.2);
draw (-1.7,0.6) -- (-0.7,0.2);
draw (-1.7,-0.6) -- (-0.7,-0.2);
draw (0.8,0.7) -- (0.35,0.2);
draw (0.8,-0.7) -- (0.35,-0.2);
draw (-0.8,0.7) -- (-0.35,0.2);
draw (-0.8,-0.7) -- (-0.35,-0.2);
draw (2.4,0.3) -- (1.2,0.1);
draw (2.4,-0.3) -- (1.2,-0.1);
draw (-2.4,0.3) -- (-1.2,0.1);
draw (-2.4,-0.3) -- (-1.2,-0.1);
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
draw[pattern=custom north west lines, hatchspread=24pt, hatchcolor=black, draw=none] (2.1,-8.7) rectangle (2.685,-5.3);
draw[pattern=custom north west lines,hatchspread=25pt,hatchcolor=black,draw=none] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{figure}
end{document}
I want to change the hatch lines to something like "custom east lines", that is this direction . Any help is appreciated.
tikz-styles pattern
tikz-styles pattern
asked 8 hours ago
AlfredoAlfredo
1207
1207
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This comes with a pattern custom horizontal lines
that is an analog of your pattern custom north west lines
. I also simplified the upper part of your code by switching to 3d coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom horizontal lines, hatchspread=8pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom horizontal lines,hatchspread=8pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
custom north east lines
are even simple because you only need to exchange two coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north east lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexprhatchspread+hatchshift}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{hatchshift}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
% horizontal lines
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom north east lines, hatchspread=10pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom north east lines,hatchspread=10pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I addedcustom north east lines
. BTW, if you gotcustom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.
– marmot
5 hours ago
1
thecustom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…
– Alfredo
5 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483659%2fhatch-direction%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This comes with a pattern custom horizontal lines
that is an analog of your pattern custom north west lines
. I also simplified the upper part of your code by switching to 3d coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom horizontal lines, hatchspread=8pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom horizontal lines,hatchspread=8pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
custom north east lines
are even simple because you only need to exchange two coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north east lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexprhatchspread+hatchshift}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{hatchshift}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
% horizontal lines
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom north east lines, hatchspread=10pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom north east lines,hatchspread=10pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I addedcustom north east lines
. BTW, if you gotcustom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.
– marmot
5 hours ago
1
thecustom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…
– Alfredo
5 hours ago
add a comment |
This comes with a pattern custom horizontal lines
that is an analog of your pattern custom north west lines
. I also simplified the upper part of your code by switching to 3d coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom horizontal lines, hatchspread=8pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom horizontal lines,hatchspread=8pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
custom north east lines
are even simple because you only need to exchange two coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north east lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexprhatchspread+hatchshift}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{hatchshift}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
% horizontal lines
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom north east lines, hatchspread=10pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom north east lines,hatchspread=10pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I addedcustom north east lines
. BTW, if you gotcustom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.
– marmot
5 hours ago
1
thecustom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…
– Alfredo
5 hours ago
add a comment |
This comes with a pattern custom horizontal lines
that is an analog of your pattern custom north west lines
. I also simplified the upper part of your code by switching to 3d coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom horizontal lines, hatchspread=8pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom horizontal lines,hatchspread=8pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
custom north east lines
are even simple because you only need to exchange two coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north east lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexprhatchspread+hatchshift}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{hatchshift}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
% horizontal lines
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom north east lines, hatchspread=10pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom north east lines,hatchspread=10pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
This comes with a pattern custom horizontal lines
that is an analog of your pattern custom north west lines
. I also simplified the upper part of your code by switching to 3d coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom horizontal lines, hatchspread=8pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom horizontal lines,hatchspread=8pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
custom north east lines
are even simple because you only need to exchange two coordinates.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{patterns,arrows.meta,3d}
% based on https://tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/54465
% defining the new dimensions and parameters
newlength{hatchspread}
newlength{hatchthickness}
newlength{hatchshift}
newcommand{hatchcolor}{}
% declaring the keys in tikz
tikzset{hatchspread/.code={setlength{hatchspread}{#1}},
hatchthickness/.code={setlength{hatchthickness}{#1}},
hatchshift/.code={setlength{hatchshift}{#1}},% must be >= 0
hatchcolor/.code={renewcommand{hatchcolor}{#1}}}
% setting the default values
tikzset{hatchspread=5pt,
hatchthickness=0.4pt,
hatchshift=1.5pt,% must be >= 0
hatchcolor=black}
% declaring the pattern
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom north east lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexprhatchspread+hatchshift}}
ifdim hatchshift > 0pt
pgfpathmoveto{pgfqpoint{0pt}{-0.15pt}}
pgfpathlineto{pgfqpoint{dimexpr0.15pt+hatchshift}{hatchshift}}
fi
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
% horizontal lines
pgfdeclarepatternformonly[hatchspread,hatchthickness,hatchshift,hatchcolor]% variables
{custom horizontal lines}% name
{pgfqpoint{dimexpr-2hatchthickness}{dimexpr-2hatchthickness}}% lower left corner
{pgfqpoint{dimexprhatchspread+2hatchthickness}{dimexprhatchspread+2hatchthickness}}% upper right corner
{pgfqpoint{dimexprhatchspread}{dimexprhatchspread}}% tile size
{% shape description
pgfsetlinewidth{hatchthickness}
pgfpathmoveto{pgfqpoint{0pt}{dimexpr 0.5hatchspread+hatchshift}}
pgfpathlineto{pgfqpoint{dimexprhatchspread+0.15pt+hatchshift}{dimexpr 0.5hatchspread+hatchshift}}
pgfsetstrokecolor{hatchcolor}
% pgfsetdash{{1pt}{1pt}}{0pt}% dashing cannot work correctly in all situation this way
pgfusepath{stroke}
}
begin{document}
begin{tikzpicture}
tdplotsetmaincoords{74}{0}
begin{scope}[tdplot_main_coords,canvas is xy plane at z=0,transform shape]
draw (0,0) circle[radius=5.375cm];
draw (-5.375,0) -- (-5.375,-1.8)
arc(180:360:5.375cm) --(5.375,0);
draw[clip] (0,0) circle[radius=2.685cm];
draw (0,-1.6) circle[radius=2.685cm];
foreach X in {0,22.5,...,337.5}
{draw (X:2.685) -- (X:1);}
end{scope}
path (0,-7) -- (5,-7) node[inner sep=2pt,circle,fill,pos=0] (x1) {};
draw[-{Latex[length=2mm]}] (0,-7) -- (6,-7) node[pos=1.1,fill=white,circle]{$r$};
draw[-{Latex[length=2mm]}] (0,-7) -- (0,-13) node[pos=1.1,circle]{$z(r,theta)$};
draw (2.685,-6.7) -- (5.375,-6.7) -- (5.375,-7.3) -- (2.685,-7.3) -- (2.685,-6.7);
draw (-2.685,-6.7) -- (-5.375,-6.7) -- (-5.375,-7.3) -- (-2.685,-7.3) -- (-2.685,-6.7);
draw (2.685,-5.3) -- (2.685,-8.7); % línea para ashurado
draw (-2.685,-5.3) -- (-2.685,-8.7);
draw (2.685,-9.3) -- (2.685,-10.7);%Linea auxiliar 1
draw (-5.375,-10.3) -- (-5.375,-11.3); % Linea auxiliar 2
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.1) -- (2.685,-10.1) node[above,pos=0.5,fill=white,circle]{$b$};% Cota 1
draw[{Latex[length=2mm]}-{Latex[length=2mm]}] (0,-10.8) -- (-5.375,-10.8) node[above,pos=0.5,fill=white,circle]{$a$};% Cota 2
draw[dashed] (-2.685,-2.3) -- (-2.685,-4.7);
draw[dashed] (2.685,-2.3) -- (2.685,-4.7);
draw[dashed] (-5.375,-1.5) -- (-5.375,-5.9);
draw[dashed] (5.375,-1.5) -- (5.375,-5.9);
path[pattern=custom north east lines, hatchspread=10pt, hatchcolor=black] (2.1,-8.7) rectangle (2.685,-5.3);
path[pattern=custom north east lines,hatchspread=10pt,hatchcolor=black] (-2.1,-8.7) rectangle (-2.685,-5.3);
draw[dashed] (-5.375,-8.1) -- (-5.375,-9.6);
end{tikzpicture}
end{document}
edited 3 hours ago
answered 6 hours ago
marmotmarmot
116k5146277
116k5146277
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I addedcustom north east lines
. BTW, if you gotcustom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.
– marmot
5 hours ago
1
thecustom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…
– Alfredo
5 hours ago
add a comment |
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I addedcustom north east lines
. BTW, if you gotcustom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.
– marmot
5 hours ago
1
thecustom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…
– Alfredo
5 hours ago
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
Hello @marmot, I made a mistake. With the code I wrote I get a different diagonal hatching. I want to get the kind of diagonal hatching that I have posted in the figure. It is diagonal lines "/". Sorry for the confusions.
– Alfredo
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
@Alfredo You already got the diagonal hatching in the code of your question. What is your question then about, i.e. what do you want us to do?
– marmot
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
if you run my code you get a different hatch that is in the figure. Watch it carefully, is not the same. The question is: How can I obtain that hatch of the figure?.
– Alfredo
5 hours ago
@Alfredo I see. I added
custom north east lines
. BTW, if you got custom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.– marmot
5 hours ago
@Alfredo I see. I added
custom north east lines
. BTW, if you got custom north west lines
from some other post, could you perhaps consider indicating the source? Whoever wrote this pattern deserves some credit, I think.– marmot
5 hours ago
1
1
the
custom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…– Alfredo
5 hours ago
the
custom north west lines
code was obtained from the answer of @Alain Matthes here: tex.stackexchange.com/questions/54464/hatch-a-rectangle-in-tikz/…– Alfredo
5 hours ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483659%2fhatch-direction%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown