我有这个图像:
如何轻松地画出这些线条(带有红色圆圈)?
我的代码:
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{figure}[h]
\centering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
%Definindo os vertices
%Vertice da reta da esquerda
\tkzDefPoint (0,0){A}
\tkzDefPoint (0,8){B}
%Vertices U1
\tkzDefPoint (1,0){C}
\tkzDefPoint (1,1.5){D}
%Vertices U2
\tkzDefPoint (4,6){E}
\tkzDefPoint (4,8){F}
%Chao1
\tkzDefPoint (-1.5,0){G}
\tkzDefPoint (6,0){H}
%Desenhando as retas
\draw (A) -- (B);
\draw (C) -- (D);
\draw (D) -- (E);
\draw (E) -- (F);
\draw (G) -- (H);
\end{tikzpicture}
\end{figure}
答案1
一种可能性是使用模式,正如@cfr 指出的那样。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\pgfdeclarepatternformonly{my north east lines}{\pgfqpoint{-1pt}{-1pt}}{%
\pgfqpoint{8pt}{8pt}}{\pgfqpoint{7pt}{7pt}}%
{
\pgfsetlinewidth{0.4pt}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{7.1pt}{7.1pt}}
\pgfusepath{stroke}
}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{figure}[h]
\centering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
%Definindo os vertices
%Vertice da reta da esquerda
\tkzDefPoint (0,0){A}
\tkzDefPoint (0,8){B}
%Vertices U1
\tkzDefPoint (1,0){C}
\tkzDefPoint (1,1.5){D}
%Vertices U2
\tkzDefPoint (4,6){E}
\tkzDefPoint (4,8){F}
%Chao1
\tkzDefPoint (-1.5,0){G}
\tkzDefPoint (6,0){H}
%Desenhando as retas
\draw (A) -- (B);
\draw (C) -- (D);
\draw (D) -- (E);
\draw (E) -- (F);
\draw (G) -- (H);
\fill [pattern=my north east lines] ([yshift=-0.25cm]G) rectangle (H);
\end{tikzpicture}
\end{figure}
\end{document}