和往常一样,我正在排版一些旧考试。我遇到了下面显示的图像
我在尝试将其 tikz 化时遇到了一些问题。在下面的最小示例中,我几乎能够重现此图像,但我的方法非常粗糙。我创建了一个半圆,并填充了它。然后使用了一些技巧来切割图形。我的主要问题是如何填充四分之一圆?(最好使用 tikz euclide)现在,任何帮助改进我的图形的帮助都将不胜感激 =)
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\def\a{3} % Defines the radius for the half circle
\tkzInit[xmin=-.5,xmax=4,ymin=-.5,ymax=4] \tkzClip
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
\tkzDefPoint(-\a,0){S3} \tkzDefPoint(0,-\a){S4}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
\tkzDrawArc[fill=blue,opacity=0.3,ultra thin](O,S1)(S3)
\tkzDrawArc[color=blue,very thick](O,S1)(S2)
\tkzDrawSquare[fill=white,color=white](S3,O)
\tkzDrawSquare[fill=white](O,A) \tkzDrawSquare[thick](O,A)
\tkzDefPoint(-0.5,0){x1} \tkzDefPoint[label=above left: $x$](1+\a,0){x2}
\tkzDefPoint(0,-0.5){y1} \tkzDefPoint[label=below left: $y$](0,1+\a){y2}
\tkzDrawSegments[very thick,-stealth](x1,x2 y1,y2) \tkzDrawSegment[dashed](A,C)
\tkzDrawSegments[ultra thick,white]({-0.5,-0.5},{-0.5,4})
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O) \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A) \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$} \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}
编辑:新 MWE
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\def\a{3} % Defines the radius and clipping.
\tkzInit[xmin=-.5,xmax=4,ymin=-.5,ymax=4] \tkzClip
% Defines all the neccecary points.
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
% Draws the quarter cirle. (triangle + arc)
\tkzDrawPolygon[fill=blue,opacity=0.3,color=blue](O,S1,S2)
\tkzDrawArc[fill=blue,opacity=0.3,ultra thin](O,S1)(S2)
\tkzDrawArc[color=blue,very thick](O,S1)(S2) \tkzDrawSegment[color=blue!30!white](S1,S2)
% Draws the square and the dashed line.
\tkzDrawSquare[color=black,thick,fill=white](O,A) \tkzDrawSegment[dashed](A,C)
% Draws the coordinate axis.
\tkzDefPoint(-0.5,0){x1} \tkzDefPoint[label=above left: $x$](1+\a,0){x2}
\tkzDefPoint(0,-0.5){y1} \tkzDefPoint[label=below left: $y$](0,1+\a){y2}
\tkzDrawSegments[very thick,-stealth](x1,x2 y1,y2)
% Draws the points and label them.
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O) \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A) \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$} \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}
答案1
tkz-euclide
手册虽然是用法语写的,但里面有很多例子。在第 112 页,你会找到命令\tkzFillSector
。在第一个例子中,你可以用它 来填充中心在从到的\tkzFillSector[fill=blue,opacity=0.3](O,S1)(S2)
区域。O
S1
S2
答案2
一些信息用来完成 Ignasi 的回答。
您可以在 tkz-euclide 中找到一些关于弧的宏,一些关于扇区的宏。在这里,可以绘制扇区并同时用
\tkzDrawSector[color=blue, thick,fill=blue,fill opacity=0.3](O,S1)(S2)
之后你只需要画轴即可。可以使用
\tkzDrawXY[noticks,very thick]
直接获取轴。
我添加了\tkzClip[space=0.75]
显示轴的尖端。可以减少xmax
和ymax
。
您可以在标签中添加“tkz
完整代码:
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tikzset{xlabel style/.style={below left=6 pt,
inner sep = 1pt,
outer sep = 0pt}}
\tikzset{xaxe style/.style ={>=stealth,->}}
\tikzset{ylabel style/.style={below left = 6 pt,
inner sep = 1pt,
outer sep = 0pt}}
\tikzset{yaxe style/.style ={>=stealth,->}}
\def\a{3} % Defines the radius and clipping.
\tkzInit[xmin=-.4,xmax=4,ymin=-.4,ymax=4]
% Defines all the neccecary points.
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
% Draws the quarter cirle. (triangle + arc)
\tkzDrawSector[color=blue, thick,fill=blue,fill opacity=0.3](O,S1)(S2)
% Draws the square and the dashed line.
\tkzDrawSquare[color=black,thick,fill=white](O,A) \tkzDrawSegment[dashed](A,C)
% Draws the coordinate axis.
\tkzDrawX[noticks,very thick,below]
\tkzDrawY[noticks,very thick]
% Draws the points and label them.
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O) \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A) \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$} \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}
结果 :