我想知道哪种工具最适合在欧几里得平面(带轴)中绘制集合,例如平面减去给定射线或平面中 y 坐标在 2 和 3 之间的点。我正要使用,pgf plots
但它不允许我如此自由地对给定区域进行着色(特别是在整个平面减去几个点或线的情况下),然后我阅读了tkz-euclide
但我不知道如何使用它。有什么建议吗?
答案1
下面是一个使用的示例pgfplots
绘制一些提到的区域(由两条水平直线围成的区域、水平条纹外的区域、平面减去一些射线、平面减去一些点):
\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}
答案2
我使用 GeoGebra 手动绘图,并且可以导出 tikz 代码。
如果你使用的是 Ubuntu,请通过运行以下命令从终端安装 GeoGebra
sudo apt update
sudo apt install geogebra
或者从以下位置下载https://www.geogebra.org/download?lang=en
谢谢。