我想修改以下代码,使角度(度和弧度)以及坐标为空白。我尝试更改部分代码,但不知道是否有更简单的方法。
% Unit circle
% Author: Supreme Aryal
% A unit circle with cosine and sine values for some
% common angles.
\documentclass[landscape]{article}
\usepackage{tikz}
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}
\begin{document}
\begin{tikzpicture}[scale=5.3,cap=round,>=latex]
\draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right,fill=white] {$x$};
\draw[->] (0cm,-1.5cm) -- (0cm,1.5cm) node[above,fill=white] {$y$};
% draw the unit circle
\draw[thick] (0cm,0cm) circle(1cm);
\foreach \x in {0,30,...,360} {
% lines from center to point
\draw[gray] (0cm,0cm) -- (\x:1cm);
% dots at each point
\filldraw[black] (\x:1cm) circle(0.4pt);
% draw each angle in degrees
\draw (\x:0.6cm) node[fill=white] {$\x^\circ$};
}
% draw each angle in radians
\foreach \x/\xtext in {
30/\frac{\pi}{6},
45/\frac{\pi}{4},
60/\frac{\pi}{3},
90/\rule{.5in}{.5pt},
120/\frac{2\pi}{3},
135/\frac{3\pi}{4},
150/\frac{5\pi}{6},
180/\pi,
210/\frac{7\pi}{6},
225/\frac{5\pi}{4},
240/\frac{4\pi}{3},
270/\frac{3\pi}{2},
300/\frac{5\pi}{3},
315/\frac{7\pi}{4},
330/\frac{11\pi}{6},
360/2\pi}
\draw (\x:0.85cm) node[fill=white] {$\xtext$};
\foreach \x/\xtext/\y in {
% the coordinates for the first quadrant
30/\frac{\sqrt{3}}{2}/\frac{1}{2},
45/\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
60/\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the second quadrant
150/-\frac{\sqrt{3}}{2}/\frac{1}{2},
135/-\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
120/-\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the third quadrant
210/-\frac{\sqrt{3}}{2}/-\frac{1}{2},
225/-\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
240/-\frac{1}{2}/-\frac{\sqrt{3}}{2},
% the coordinates for the fourth quadrant
330/\frac{\sqrt{3}}{2}/-\frac{1}{2},
315/\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
300/\frac{1}{2}/-\frac{\sqrt{3}}{2}}
\draw (\x:1.25cm) node[fill=white] {$\left(\xtext,\y\right)$};
% draw the horizontal and vertical coordinates
% the placement is better this way
\draw (-1.25cm,0cm) node[above=1pt] {\(\big(\rule{.25in}{1pt},\rule{.25in}{1pt}\big)\)};
(1.25cm,0cm) node[above=1pt] {}
(0cm,-1.25cm) node[fill=white] {};
(0cm,1.25cm) node[fill=white] {\(\big(\rule{.25in}{1pt},\rule{.25in}{1pt}\big)\)};
\end{tikzpicture}
\end{document}
任何帮助都将不胜感激。感谢您的时间
答案1
嗯,像这样吗?
为此,您只需向text=white
所有循环中的节点添加选项:
node[fill=white, text=white]
顺便问一下,您可以添加您的代码源吗?
附录(改进): 我将制作框架节点、简化(我的)代码和页面中心图像:
\documentclass[landscape]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage[margin=1in]{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[p]
\centering
\begin{tikzpicture}[scale=5.5,
>={Stealth[scale=2]},
lbl/.append style = {draw=#1, fill=white, font=\large, text=white,
minimum height=3ex, inner xsep=5pt, inner ysep=2pt}
]
\draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right,font=\Large] {$x$};
\draw[->] (0cm,-1.4cm) -- (0cm,1.4cm) node[above,font=\Large] {$y$};
% draw the unit circle
\draw[thick] (0cm,0cm) circle(1cm);
% draw angle in degrees and radians, draw x and y vale
\foreach \id/\ir/\x/\y in {
30/\frac{\pi}{6}/\frac{1}{2} /\frac{\sqrt{3}}{2},
45/\frac{\pi}{4}/\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
60/\frac{\pi}{3}/\frac{1}{2} /\frac{\sqrt{3}}{2},
90/\frac{\pi}{2}/0/1,
120/\frac{2\pi}{3}/-\frac{1}{2}/\frac{\sqrt{3}}{2},
135/\frac{3\pi}{4}/-\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
150/\frac{5\pi}{6}/-\frac{\sqrt{3}}{2}/\frac{1}{2},
180/\pi/-1/0,
210/\frac{7\pi}{6}/-\frac{\sqrt{3}}{2}/-\frac{1}{2},
225/\frac{5\pi}{4}/-\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
240/\frac{4\pi}{3}/-\frac{1}{2}/-\frac{\sqrt{3}}{2},
270/\frac{3\pi}{2},
300/\frac{5\pi}{3}/\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
315/\frac{7\pi}{4}/\frac{1}{2}/-\frac{\sqrt{3}}{2},
330/\frac{11\pi}{6}/\frac{\sqrt{3}}{2}/-\frac{1}{2},
360/2\pi/1/0
}
\draw (0,0) -- ++ (\id:6mm) node[lbl=red] {$\id$}
-- ++ (\id:2.2mm) node[lbl=blue] {$\ir$}
-- ++ (\id:4mm) node[lbl=teal] {$\left(\x,\y\right)$} ;
\end{tikzpicture}
\end{table}
\end{document}
(红线表示页面布局)
答案2
我采纳了 @zarko 的想法,用白色填充文本。然后我添加了 45 度线段来完成圆。我不得不分解整个代码来查看它的作用,以便进行更改:
\documentclass[landscape]{article}
\usepackage{tikz}
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}
\begin{document}
\begin{tikzpicture}[scale=5.3,cap=round,>=latex]
\draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right,fill=white] {$x$};
\draw[->] (0cm,-1.5cm) -- (0cm,1.5cm) node[above,fill=white] {$y$};
% draw the unit circle
\draw[thick] (0cm,0cm) circle(1cm);
\foreach \x in {0,30,...,360} {
\draw[gray] (0cm,0cm) -- (\x:1cm);
\draw (\x:0.6cm) node[fill=white,text=white] {$\x^\circ$};
\filldraw[black] (\x:1cm) circle(0.5pt);}
\filldraw[black] (\x:1cm) circle(0.4pt);
\foreach \x in {45,135,...,360} {
\draw[gray] (0cm,0cm)--(\x:1cm);
\filldraw[black] (\x:1cm) circle(0.5pt);
\draw (\x:0.6cm) node[fill=white,text=white] {$\x^\circ$};}
\foreach \x/\xtext in {
30/\frac{\pi}{6},
45/\frac{\pi}{4},
60/\frac{\pi}{3},
90/\frac{\pi}{2},
120/\frac{2\pi}{3},
135/\frac{3\pi}{4},
150/\frac{5\pi}{6},
180/\pi,
210/\frac{7\pi}{6},
225/\frac{5\pi}{4},
240/\frac{4\pi}{3},
270/\frac{3\pi}{2},
300/\frac{5\pi}{3},
315/\frac{7\pi}{4},
330/\frac{11\pi}{6},
360/2\pi}
\draw (\x:0.85cm) node[fill=white,text=white] {$\xtext$};
\foreach \x/\xtext/\y in {
% the coordinates for the first quadrant
30/\frac{\sqrt{3}}{2}/\frac{1}{2},
45/\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
60/\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the second quadrant
150/-\frac{\sqrt{3}}{2}/\frac{1}{2},
135/-\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
120/-\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the third quadrant
210/-\frac{\sqrt{3}}{2}/-\frac{1}{2},
225/-\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
240/-\frac{1}{2}/-\frac{\sqrt{3}}{2},
% the coordinates for the fourth quadrant
330/\frac{\sqrt{3}}{2}/-\frac{1}{2},
315/\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
300/\frac{1}{2}/-\frac{\sqrt{3}}{2}}
\draw (\x:1.25cm) node[fill=white]
{$\Big(\rule{.25in}{.25pt},\rule{.25in}{.25pt}\Big)$};
% draw the horizontal and vertical coordinates
% the placement is better this way
\draw (-1.25cm,0cm) node[above=1pt] {$(-1,0)$}
(1.25cm,0cm) node[above=1pt] {$(1,0)$}
(0cm,-1.25cm) node[fill=white] {$(0,-1)$}
(0cm,1.25cm) node[fill=white] {$(0,1)$};
\end{tikzpicture}
\end{document}
% draw each angle in radians
\foreach \x/\xtext in {
30/\frac{\pi}{6},
45/\frac{\pi}{4},
60/\frac{\pi}{3},
90/\rule{.5in}{.5pt},
120/\frac{2\pi}{3},
135/\frac{3\pi}{4},
150/\frac{5\pi}{6},
180/\pi,
210/\frac{7\pi}{6},
225/\frac{5\pi}{4},
240/\frac{4\pi}{3},
270/\frac{3\pi}{2},
300/\frac{5\pi}{3},
315/\frac{7\pi}{4},
330/\frac{11\pi}{6},
360/2\pi}
\draw (\x:0.85cm) node[fill=white] {$\xtext$};
\foreach \x/\xtext/\y in {
% the coordinates for the first quadrant
30/\frac{\sqrt{3}}{2}/\frac{1}{2},
45/\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
60/\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the second quadrant
150/-\frac{\sqrt{3}}{2}/\frac{1}{2},
135/-\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
120/-\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the third quadrant
210/-\frac{\sqrt{3}}{2}/-\frac{1}{2},
225/-\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
240/-\frac{1}{2}/-\frac{\sqrt{3}}{2},
% the coordinates for the fourth quadrant
330/\frac{\sqrt{3}}{2}/-\frac{1}{2},
315/\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
300/\frac{1}{2}/-\frac{\sqrt{3}}{2}}
\draw (\x:1.25cm) node[fill=white] {$\left(\xtext,\y\right)$};
% draw the horizontal and vertical coordinates
% the placement is better this way
\draw (-1.25cm,0cm) node[above=1pt] {\(\big(\rule{.25in}{1pt},\rule{.25in}{1pt}\big)\)};
(1.25cm,0cm) node[above=1pt] {}
(0cm,-1.25cm) node[fill=white] {};
(0cm,1.25cm) node[fill=white] {\(\big(\rule{.25in}{1pt},\rule{.25in}{1pt}\big)\)};
'''