2

Can you anyone suggest how to shade in the highlighted areas (in red) in the image below?

desired output

\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{pgfplots}
\usepackage{amsmath}
\newtheorem{theorem}{THEOREM}
\newtheorem{proof}{PROOF}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\usepackage{fancyhdr}
\usepackage{bigints}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{color,xcolor}
\usepackage{booktabs,array}
\usepackage{hyperref}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{polynom}
\usepackage{flexisym}
\usepackage{wallpaper}
\usepackage{blkarray}
\usepackage{caption}
\usepackage{lscape}
\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{statistics}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}
\newdimen\R
\R=3.0cm
%
\draw[thick] (-3,0) -- (0,0) -- (0,3);
\draw[thick] (0,3) arc(90:180:\R);
%
\draw[thick] (0,0) arc(0:180:0.5*\R);
\draw[thick] (0,3) arc(90:270:0.5*\R);
%
\draw[thick] (0,0) rectangle (-0.25,0.25);
%
\draw [thick,dashed,{Latex[width=3mm]}-{Latex[width=3mm]}] (-3,-0.4) -- node[fill=white] {$4$ \text{cm}} (0,-0.4);
%
\draw [thick,dashed,{Latex[width=3mm]}-{Latex[width=3mm]}] (0.6,0) -- node[fill=white] {$4$ \text{cm}} (0.6,3);
%
%\draw[thick,red] (0,3) arc(90:180:\R) -- arc(0:180:0.5*\R);
\end{tikzpicture}
\end{document}
2

Like this?

\documentclass[tikz,border=5]{standalone}
\def\first{(0,4) arc(90:180:4)}
  \def\second{(0,0) arc(0:180:2)}
  \def\third{(0,4) arc(90:270:2)}
\begin{document}
\begin{tikzpicture}[line cap=rect] 

   \fill[red]\first;
   \fill[white]\second; 
   \fill[white]\third;
 
\begin{scope}
    \clip \second ;
    \fill[red]\third;
\end{scope}
      
\draw [thick] (0,0)--(0,4);
\draw [thick] (0,0)--(-4,0);

\draw [thick](0,4) arc(90:180:4);
\draw [thick](0,0) arc(0:180:2);
\draw [thick](0,4) arc(90:270:2);
\end{tikzpicture}
\end{document}

enter image description here

1
  • This worked beautifully, Thank you so much!
    – Will Kim
    Sep 8 '20 at 2:49
2

The even odd rule allows you to color a path. For this, I have combined 3 paths into one.

\draw[thick,fill=red,even odd rule] (0,3) arc(90:180:\R) arc(180:0:0.5*\R) arc(270:90:0.5*\R);%<-- Even odd rule

I have also simplified your code slightly. The code is commented out with % <--

screenshot

\documentclass[tikz,border=5mm]{standalone}

\usepackage{amsmath}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[>={Latex[width=3mm]}]%<-- arrow style
\newdimen\R
\R=3.0cm
%
\draw[thick] (-3,0) -- (0,0) -- (0,3);
\draw[thick,fill=red,even odd rule] (0,3) arc(90:180:\R) arc(180:0:0.5*\R) arc(270:90:0.5*\R);%<-- Even odd rule 
\draw[thick] (0,0) rectangle (-0.25,0.25);
\draw [thick,dashed,<->] (-3,-0.4) -- node[fill=white] {$4$ \text{cm}} (0,-0.4);
\draw [thick,dashed,<->] (0.6,0) -- node[fill=white] {$4$ \text{cm}} (0.6,3);
\end{tikzpicture}
\end{document}

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.