0

Please guide how can I shade the region ODBE in the given figure....

\begin{tikzpicture}
\tikzset{dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1}}
\draw (0,5)--(0,0)node{O}--(5,0);
\draw [name path=P1] (2,0)node(b){D} -- (0,4)node{A}; 
\draw [name path=P2] (3,0)node(b){C} -- (0,2)node(b){E}; 
\path [name intersections={of=P1 and P2,by=B}];
\node [dot=B]  at (B) {};
\end{tikzpicture}

Please guide , thanks a lot will be of great help...

1 Answer 1

1

The following code will create what you see in the appended figure. You will need to declare a background layer to put the filled polygon in the back so that it wont overlay the node's labels.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}

\pgfdeclarelayer{bg}    % declare background
\pgfsetlayers{bg,main}  % order of layers (main = standard layer)

\begin{document}
\begin{tikzpicture}
\tikzset{dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1}}
\draw (0,5)-- (0,0)node(o){O} --(5,0);
\draw [name path=P1] (2,0)node(d){D} -- (0,4)node(a){A}; 
\draw [name path=P2] (3,0)node(c){C} -- (0,2)node(e){E}; 
\path [name intersections={of=P1 and P2,by=b}];
\node [dot=B]  at (b) {};

\begin{pgfonlayer}{bg}    % select background
     \path [fill=green!50] (o.center) -- (d.center) -- (b) -- (e.center) -- cycle;
\end{pgfonlayer}

\end{tikzpicture}
\end{document}

enter image description here

1
  • Thank you so much.. it is really great.... God bless you ... thanks a lot once again.
    – Sachin
    Mar 17, 2020 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .