I'm fairly new to tikz, so I might have missed how to do this, but I wasn't sure how to look for it. I'm trying to redraw the figure below:

Gradient pattern

I can build most of the figure with no problem, but I'm not sure how to build the "U" shaped pattern. Namely, I'm not sure how to set a new pattern that draws the horizontal lines; and second, I don't know if there's an option to gradually increase the spacing between the horizontal lines (they're closer together at the top and further away as you go down). I've resorted to a gray filling in the mean time, but I was just wondering if such pattern is possible in latex. Here's a MWE of just that part of the figure with the gray filling: (I'm using circuitikz because of the circuit part, but not used in this example)



    \fill[gray!20] %grayfilling
    (0.5,4.5) -- (1,4.5) -- (1,2.5)  -- (5,2.5) -- (5,4.5) -- (5.5,4.5) -- (5.5,1) -- (0.5,1) -- cycle
\draw[thick] (0.5,5) -- (0.5,1) %external wall
(0.5,1) -- (5.5,1)
(5.5,1) -- (5.5,5)
\draw[thick](1,5) -- (1,2.5) %internalwall
(1,2.5) -- (5,2.5)
(5,2.5) -- (5,5)




  • 2
    \foreach\y in{0,...,12}\draw[dash pattern=on15ptoff5pt,dash phase=\y0pt](0,-\y*\y/20)--+(10,0); – Symbol 1 Apr 23 '17 at 18:59
  • @Symbol1 I'd think some sort of clipping/scope would be used to adjust that to the shape? I'm not exactly sure how, though? – ralk912 Apr 23 '17 at 21:53
  • 1
    Yes. So basically you change \fill[gray!20] to \clip, and paste my code after, and then you need to adjust the shift. – Symbol 1 Apr 23 '17 at 23:21

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.