0

I want to draw one figure as follows

enter image description here

but how can I make that the shaded part what I marked in red is a little lighter than the rest? or use dashed line for that part?

my MWE is as follows

\begin{tikzpicture}
  \draw (-4,0) -- (4,0);
  \draw (0,-5) -- (0,5);
  \fill (0,0) coordinate (o) node[anchor=north east]{$O$};

\draw[fill=Green,opacity=0.3,] (1,2.5) -- (1,-1.5) node[text=black,opacity=1,below,xshift=-0.5cm,yshift=-0.5cm]{$W$}-- (-1,-2.5) -- (-1,1.5) -- cycle; \draw[mydarkblue, line width=1pt] (3,-1.5) node[above,text=black]{$L$} -- (-2,1); \end{tikzpicture}

Thanks in advance.

Ben
  • 105
  • 7

1 Answers1

0

What I changed:

  • Draw the line segment behind plane, then the plane, then the line segment in front of plane. (You may want to do similar things to the horizontal axis line.)
  • Fill the plane in light green fill=Green!30 and adjust the opacity opacity=.8.
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}

\colorlet{mydarkblue}{blue!50!black}

\begin{document} \begin{tikzpicture} \draw (-4,0) -- (4,0); \draw (0,-5) -- (0,5); \fill (0,0) coordinate (o) node[anchor=north east]{$O$};

\draw[mydarkblue, line width=1pt] (-2,1) -- (0,0); \draw[fill=Green!30, opacity=.8] (1,2.5) -- (1,-1.5) node[text=black, opacity=1, below, xshift=-0.5cm, yshift=-0.5cm] {$W$} -- (-1,-2.5) -- (-1,1.5) -- cycle; \draw[mydarkblue, line width=1pt] (3,-1.5) node[above,text=black] {$L$} -- (0,0); \end{tikzpicture} \end{document}

enter image description here

muzimuzhi Z
  • 26,474
  • thanks for the help, but can find the way to make shaded part automaticlly in stead of drawing the line separately? – Ben May 06 '22 at 10:20
  • The tikz package itself doesn't support real 3d plotting and filling. You may take a look at Sketch. I haven't used it before and note it's no longer being maintained since 2012. – muzimuzhi Z May 06 '22 at 14:37
  • OK, anyway thanks, nice weekend – Ben May 06 '22 at 19:07