TransWikia.com

Fill color in a region

TeX - LaTeX Asked by tobinz on February 14, 2021

I want to fill gray color to the left of the curve. Can anyone give some hints? Thanks!

 begin{tikzpicture}

   begin{scope}[shift={(0,0)}]

  draw [opacity=1, very thick, draw=red!50!black](2.4,4.5) {ellipse (2cm and 1cm)}; 

  draw [very thick]  (2.6,5.5) parabola bend (3.4,4.6) (4,3.9);
  
end{scope} 
end{tikzpicture}

enter image description here

One Answer

Just clip with your ellipse and fill an accurate region. Here's a very rough (but working) example:

documentclass[tikz,border=10pt]{standalone}

begin{document}

    begin{tikzpicture}

        draw [opacity=1, very thick, draw=red!50!black](2.4,4.5) {ellipse (2cm and 1cm)}; 
        
        draw [very thick]  (2.6,5.5) parabola bend (3.4,4.6) (4,3.9);
        
        % Here just to see the region filled        
        draw[densely dashed,orange] (2.6,5.5) parabola bend (3.4,4.6) (4,3.9) --++ (0,-1) --++ (-4,0) --++ (0,3) -|  cycle;
        
        clip (2.4,4.5) {ellipse (2cm and 1cm)};
        fill[blue,opacity=0.5] (2.6,5.5) parabola bend (3.4,4.6) (4,3.9) --++ (0,-1) --++ (-4,0) --++ (0,3) -| cycle;
          
    end{tikzpicture}

end{document}

Fill a region

EXPLANATION: Below, you will see in dashed orange the region I filled.

explanation

Correct answer by SebGlav on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP