答案1
您可以轻松地像使用普通矩形一样使用它来绘制它并从库中tikz
填充。north east lines
patterns
\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}[yscale=4]
\draw (-1.5,0)--(3,0) (-1,0)--(-1,.75);
\draw[pattern=north east lines] (-.5,0) rectangle (.5,.25) (.5,0) rectangle (1.5,.5) (1.5,0) rectangle (2.5,.25);
\foreach \x in {0,1,2}
\draw (\x,0) -- (\x,-1pt) node[below]{\footnotesize\x};
\foreach \y in {0.25,0.50}
\draw (-1,\y) -- ({-1cm-4pt},\y) node[left]{\footnotesize\y};
\end{tikzpicture}
\end{document}