4

I was wondering which is the most appropriate tool to draw sets in the Euclidean plane (with axis) such as the plane minus a given ray or the points in the plane which have a y coordinate between 2 and 3 . I was about to use pgf plots but that doesn't allow me to shade so freely the given regions (specially in the case of the whole plane minus a couple of points or lines), then I read about tkz-euclide but I have no clue how to use that one. Any suggestion?

10

Here's an example using pgfplots to draw some of the regions mentioned (the region bounded by two horizontal straight lines, the region outside a horizontal strip, the plane minus some rays, the plane minus some points):

\documentclass[border=3pt,varwidth=true,varwidth=40cm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=-1,
ymax=4
]
\addplot[name path=line1,dashed] {3};
\addplot[name path=line2,dashed] {2};
\addplot[cyan!30]   fill between[of=line1 and line2];
\end{axis}
\end{tikzpicture}\quad
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=-3,
ymax=3
]
\addplot[name path=line1,draw=none] {3};
\addplot[name path=line2,draw=none] {-3};
\addplot[name path=line3,dashed] {1};
\addplot[name path=line4,dashed] {-1};
\addplot[brown!30]   fill between[of=line1 and line3];
\addplot[brown!30]   fill between[of=line2 and line4];
\end{axis}
\end{tikzpicture}\par\bigskip
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=-3,
ymax=3
]
\addplot[name path=line1,draw=none] {3};
\addplot[name path=line2,draw=none] {-3};
\addplot[orange!30]   fill between[of=line1 and line2];
\draw[fill=white]
  (axis cs:0,0) circle [radius=3pt];
\draw[double,double distance=2pt]
  ([shift={(0:2.7pt)}]axis cs:0,0) -- ++(0:30cm);
\draw[double,double distance=2pt]
  ([shift={(135:2.7pt)}]axis cs:0,0) -- ++(135:30cm);
\end{axis}
\end{tikzpicture}\quad
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=-3,
ymax=3
]
\addplot[name path=line1,draw=none] {3};
\addplot[name path=line2,draw=none] {-3};
\addplot[magenta!30]   fill between[of=line1 and line2];
\draw[fill=white]
  (axis cs:0,0) circle [radius=3pt];
\draw[fill=white]
  (axis cs:-2,2) circle [radius=3pt];
\draw[fill=white]
  (axis cs:1,-1.7) circle [radius=3pt];
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

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.