I need to draw a figure with unlimited fill region as the attachment figure. Thank you!enter image description here

  • 1
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – user31729 Sep 19 '14 at 14:45
  • I don't really understand what you mean by "unlimited fill regions"? Do you want to fill the whole page? Because somewhere the filling has to stop. Or you you simply want a filled region without a drawn boundary line? – Fritz Sep 19 '14 at 14:47
  • 1
    are you looking for \pagecolor{green} ? – David Carlisle Sep 19 '14 at 14:50
  • If you mean "fill without drawing an edge", as in the regions between lines in your graph, then this is by default the way tikz's \fill works, unless you also add a [draw] option to it. – JLDiaz Sep 19 '14 at 15:30

This is possible via fillbetween library of pgfplots. Consult the manual for putting the labels and removing ticks etc. You can also search this site for examples.

\begin{axis}[axis lines=middle,
    axis equal,
    no marks,
    xmax=5,xmin=-5,ymax=5,ymin=-5,samples=3]% lines don't need too many samples
\addplot+[name path=o,draw=none] {0};
\addplot+[name path=a] {-1*x};
\addplot+[name path=b] {1/6*x};
\addplot+[name path=c] {1/2*x};
\addplot+[name path=d] {3*x};

\addplot[pattern=north east lines,pattern color=blue] fill between[of=o and b] ;
\addplot[pattern=north west lines,pattern color=red] fill between[of=b and c] ;
\addplot[pattern=vertical lines,pattern color=green] fill between[of=c and d] ;
\addplot[pattern=horizontal lines,pattern color=orange] fill between[reverse=false,of=a and d] ;

enter image description here

Once you are comfortable, you can produce the same with a for loop.

  • I'm guessing what the OP means by "unlimited" is that the outer (large r) boundary is not a regular shape like a rectangle in your MWE, but rather just a sector hatched out to some amorphous radius. Think "schematic" rather than "graph". Of course, I could be mistaken in interpreting the OP. – Steven B. Segletes Sep 19 '14 at 15:39
  • @StevenB.Segletes Indeed it might be that too. But you can draw the graph larger and add a \clip <whatever closed curve here> in the end of the code to clip everything with a one liner. – percusse Sep 19 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.