我设计了那个笛卡尔平面。
\documentclass[border=3]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin=-6,ymin=-6,xmax=6,ymax=6]
\tkzAxeXY
\tkzGrid
\coordinate (a) at (2.0,0.0);
\coordinate (b) at (4.0,3.0);
\coordinate (c) at (-3.0,-5.0);
\coordinate (d) at (-4.0,2.0);
\draw [color=black,fill=gray,fill opacity=0.5] (a) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (b) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (c) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (d) circle (0.1cm);
\end{tikzpicture}
\end{document}
我应该做出一些改变。
我怎样才能在每个点附近添加一个字母?
如何增加 x 轴和 y 轴的粗细?
我想增加数字的大小。
我想为所有正数加上 + 号。
非常感谢。
答案1
仅针对轴和网格考虑以下代码:
\documentclass[tikz,border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[very thin,color=gray!15,step=.5] (-6.1,-6.1) grid (6.5,6.5);
\draw[-latex] (-6.2,0) -- (6.7,0) node[right] {$x$};
\draw[-latex] (0,-6.2) -- (0,6.7) node[above] {$y$};
\coordinate [label=below left:O] (a) at (0,0);
\foreach \i in {-6,...,-2,-1,1,2,...,6}
\draw[gray!65] (\i,.1)--(\i,-.1) node[below] {$\i$};
\foreach \i in {-6,...,-2,-1,1,2,...,6}
\draw[gray!65] (.1,\i)--(-.1,\i) node[left] {$\i$};
\end{tikzpicture}
\end{document}
输出:
添加:如果您想添加点和标签,请在\tkzpicture
代码中输入以下代码:
\filldraw[black,opacity=.5] (2,0) circle(3pt) node[above] {$A$};
\filldraw[black,opacity=.5] (4,3) circle(3pt) node[above] {$B$};
\filldraw[black,opacity=.5] (-3,0) circle(3pt) node[above] {$C$};
\filldraw[black,opacity=.5] (-4,2) circle(3pt) node[above] {$D$};
答案2
label
在 s后面添加 a\coordinate
,见下面的示例。\tkzAxeXY[very thick]
, 例如。\tkzAxeXY[label options={font=\Large}]
例如。(当然,除了 之外,还要添加该选项very thick
,见下面的示例。)\tkzAxeXY
使用包\numprint
中的命令numprint
来打印数字,因此您可以\npaddplus
在之后立即添加该包中的宏\begin{tikzpicture}
。\tkzAxeXY[orig=false]
删除零,然后使用 手动添加一个不带加号的零\node [below right=3pt,fill=white,font=\Large] {$0$};
。
\documentclass[border=3]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
% \tkzAxeXY uses numprint for number printing
% this macro turns on explicit plus signs
\npaddplus
\tkzInit[xmin=-6,ymin=-6,xmax=6,ymax=6]
\tkzGrid % moved before \tkzAxeXY
\tkzAxeXY[
very thick, % increase width of axes lines
label options={font=\Large,}, % increase font size
orig=false % don't print zeros
]
% add zero label manually
\node [below right=3pt,fill=white,font=\Large] {$0$};
% use label=<position>:<text> to add labels next to coordinates
\coordinate [label=above right:$A$] (a) at (2.0,0.0);
\coordinate [label=above left:$B$] (b) at (4.0,3.0);
\coordinate [label=below right:$C$] (c) at (-3.0,-5.0);
\coordinate [label=below left:$D$] (d) at (-4.0,2.0);
\draw [color=black,fill=gray,fill opacity=0.5] (a) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (b) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (c) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (d) circle (0.1cm);
\end{tikzpicture}
\end{document}
我找不到移动轴标签的方法,所以下面有点儿像 hack。\tkzAxeXY
我没有使用 ,而是分别使用了\tkzAxeX
和\tkzAxeY
,因为样式似乎不能单独设置。为了同时更改位置和字体大小,我在设置中添加了格式化宏label
。因此,label=\raisebox{4mm}{\Large$y$}
将\tkzAxeY
y 标签向上移动一点并增加字体大小,label=\hspace{4mm}\Large$x$
对于 x 轴,同样使用\hspace
将其向右移动。
\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
% \tkzAxeXY uses numprint for number printing
% this macro turns on explicit plus signs
\npaddplus
\tkzInit[xmin=-6,ymin=-6,xmax=6,ymax=6]
\tkzGrid % moved before \tkzAxeXY
\tkzAxeX[
label=\hspace{4mm}\Large$x$,
very thick, % increase width of axes lines
label options={font=\Large}, % increase font size
orig=false % don't print zeros
]
\tkzAxeY[
label=\raisebox{4mm}{\Large$y$},
very thick, % increase width of axes lines
label options={font=\Large,}, % increase font size
orig=false % don't print zeros
]
% add zero label manually
\node [below right=3pt,fill=white,font=\Large] {$0$};
% use label=<position>:<text> to add labels next to coordinates
\coordinate [label=above right:$A$] (a) at (2.0,0.0);
\coordinate [label=above left:$B$] (b) at (4.0,3.0);
\coordinate [label=below right:$C$] (c) at (-3.0,-5.0);
\coordinate [label=below left:$D$] (d) at (-4.0,2.0);
\draw [color=black,fill=gray,fill opacity=0.5] (a) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (b) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (c) circle (0.1cm);
\draw [color=black,fill=gray,fill opacity=0.5] (d) circle (0.1cm);
\end{tikzpicture}
\end{document}