Dashed polygone with custom pattern
📅 May 29, 2024 | 👁️ Views: 28

\documentclass{standalone}
\standaloneconfig{margin=2mm}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
% Custom -45 degree dashed pattern definition
\pgfdeclarepatternformonly{diagonal dashes}{\pgfpoint{0pt}{0pt}}{\pgfpoint{20pt}{20pt}}{\pgfpoint{20pt}{20pt}}%
{
\pgfsetlinewidth{0.5pt}
\foreach \i in {-20, -10, ..., 20} {
\pgfpathmoveto{\pgfpoint{0pt}{\i pt}}
\pgfpathlineto{\pgfpoint{20pt}{20pt+\i pt}}
}
\pgfusepath{stroke}
}
\begin{document}
\begin{tikzpicture}[scale=1.00]
\begin{axis}[axis lines=center,
xlabel={$x$},
ylabel={$y$},
ytick={-1,0.5,1,1.5,2,3},
xtick={-1.5,1,2.2,3},
xmin=-4.5,xmax=5,
ymin=-2,ymax=2,
unbounded coords=jump,
samples=200,
xticklabel style={font=\tiny},
yticklabel style={font=\tiny},
]
\coordinate (A) at (-2,-1);
\coordinate (B) at (0,-1);
\coordinate (C) at (2,1);
\coordinate (D) at (0,1);
% Fill the polygon with a custom -45 degree dashed pattern
\fill[pattern=diagonal dashes, pattern color=black!20] (A) -- (B) -- (C) -- (D) -- cycle;
% Draw the outline of the polygon
\draw (A) -- (B) -- (C) -- (D) -- cycle;
\draw (0,0) circle (0.1cm);
\node[right] at (B) {$v=u-1$};
\node[right,rotate=45] at (D) {$v=u+1$};
\end{axis}
\end{tikzpicture}
\end{document}
Related Courses, Exams, and Exercises
- colorer un angle (arc) Course
- Coordonnées relatives avec angles Course
- Dashed polygone with dashed pattern Course
- Deux parallèles et une sécante Course
- draw curved lines with tikz Course
- Figure : cercle , diametre et intersections Course
- figure, circle, rectangle, axes Course
- Médiatrice et hauteur d'un triangle Course
- Squares Course
- Syntax des abreviations de coordonées dans Latex Course
- Un parallèlipipède avec Latex Course
- المتوسط ، الإرتفاع والمنصف Course
Course PDF:
Recent Articles

Quran Search: A Feature rich and modern design
13 Feb 2025
Categories