嗨,我在绘制这个框架时遇到了问题,颜色也出现了问题,尤其是使用 tikz 程序或 hobby 程序时,该程序无法与 hobby 一起编译。有人能帮我画这张图片吗?
谢谢。
我使用了这些代码:
\documentclass[tikz]{standalone}
\usetikzlibrary{hobby,patterns}
\begin{document}
\begin{tikzpicture}
\draw[thick,->] (52,0) -- (60,0) node[anchor=north west] {$x'$};
\draw[thick,->] (56,-04) -- (56,04) node[anchor=south east] {$x_N$};
\node[draw=red,dashed,thick,circle,minimum width=4cm] (n) at (56,0) {};
\fill[pattern=north east lines,opacity=.6] (58,0)arc(0:180:2cm) -- (58,0);
\draw[thick,->] (57.5,1.55) -- (58,2) node[anchor=north west] {$I^{+}(1)$};
\draw[thick,->] (57.5,-1.55) -- (58,-2) node[anchor=north west] {$I(1)$};
\draw (56,0) node[below right] {$O$} node{$\bullet$};
\draw (58,0) node[below right] {$1$} node{};
\draw (54,0) node[below left] {$-1$} node{};
\end{tikzpicture}
\end{document}
答案1
这是一个选项:
代码:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{patterns}
\tikzset{
smalldot/.style={
circle,
fill,
inner sep=1.2pt
}
}
\begin{document}
\begin{tikzpicture}[>=latex]
\draw[->]
(-5,0) -- (5,0);
\draw[->]
(0,-1) -- (0,5);
\begin{scope}
\clip
(-5,0) rectangle (5,5);
\draw
(0,0) circle [radius=3cm];
\draw
(0,0) circle [radius=4cm];
\end{scope}
\draw
(-1,1) circle [radius=0.65cm] node[smalldot,label={below:$x_{0}$}] {};
\begin{scope}
\clip
(0,0) circle [radius=3cm];
\draw[pattern=north east lines]
(45:3cm) circle [radius=0.65cm];
\end{scope}
\draw
(45:3cm) circle [radius=0.65cm] node[smalldot,label={right:$x_{0}$}] {};
\draw
(-1,1) -- node[above left=-2pt] {$\rho$} ++(30:0.65cm);
\foreach \Posicion\Label in
{(3,0)/$r$,(-3,0)/$-r$,(4,0)/$1$,(-4,0)/$-1$}
{
\node[below] at \Posicion {\strut\Label};
}
\node[anchor=north west] at (5,0)
{$x'\in\mathbb{R}^{N-1}$};
\node[anchor=west] at (0,5)
{$x_{N}$};
\draw[->,help lines]
(70:3cm) to[out=40,in=180] ++(2cm,20pt) node[right,text=black] {$I^{\ast}(r)$};
\draw[->,help lines]
(70:4cm) to[out=40,in=180] ++(2cm,20pt) node[right,text=black] {$I^{\ast}(1)$};
\end{tikzpicture}
\end{document}
在评论中要求添加圆顶颜色:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{patterns}
\tikzset{
smalldot/.style={
circle,
fill,
inner sep=1.2pt
}
}
\begin{document}
\begin{tikzpicture}[>=latex]
\begin{scope}
\clip
(-5,0) rectangle (5,5);
\filldraw[fill=orange!20]
(0,0) circle [radius=4cm];
\filldraw[fill=cyan!30]
(0,0) circle [radius=3cm];
\end{scope}
\draw[->]
(-5,0) -- (5,0);
\draw[->]
(0,-1) -- (0,5);
\draw
(-1,1) circle [radius=0.65cm] node[smalldot,label={below:$x_{0}$}] {};
\begin{scope}
\clip
(0,0) circle [radius=3cm];
\filldraw[fill=red!50]
(45:3cm) circle [radius=0.65cm];
\end{scope}
\draw
(45:3cm) circle [radius=0.65cm] node[smalldot,label={right:$x_{0}$}] {};
\draw
(-1,1) -- node[above left=-2pt] {$\rho$} ++(30:0.65cm);
\foreach \Posicion\Label in
{(3,0)/$r$,(-3,0)/$-r$,(4,0)/$1$,(-4,0)/$-1$}
{
\node[below] at \Posicion {\strut\Label};
}
\node[anchor=north west] at (5,0)
{$x'\in\mathbb{R}^{N-1}$};
\node[anchor=west] at (0,5)
{$x_{N}$};
\draw[->,help lines]
(70:3cm) to[out=40,in=180] ++(2cm,20pt) node[right,text=black] {$I^{\ast}(r)$};
\draw[->,help lines]
(70:4cm) to[out=40,in=180] ++(2cm,20pt) node[right,text=black] {$I^{\ast}(1)$};
\end{tikzpicture}
\end{document}
答案2
以下是 tikz 的初始响应
\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
\draw[->] (-1.5,0) -- (1.5,0) node[below]{$x'\in \mathrm{R}^{N-1}$};
\draw [->] (0,-0.1)--(0,1.5) node[right]{$x_N$};
\draw (1,0)node[below]{1} arc (0:180:1)node[below]{-1};
\def\radius{0.7}
\draw (\radius,0)node[below]{r} arc (0:180:\radius)node[below]{-r};
\draw (35:\radius) circle (0.2);
\begin{scope}
\draw[clip] (\radius,0)node[below]{r} arc (0:180:\radius)node[below]{-r};
\draw[fill=yellow] (35:\radius) circle (0.2);
\end{scope}
\end{tikzpicture}
\end{document}
答案3
为了消磨时间,我尝试使用 MetaPost 和 LuaLaTeX 重现 Gonzalo Medina 的解决方案。这并不容易,但最困难的是要在标准 SVG 规范(由软件包为 MetaPost 翻译mpcolornames
)中找到(或多或少)匹配的颜色,因为我不明白的着色说明tikz
。(我太懒了,没有开始阅读手册,但我很快就会学到更多,我保证 :-))
\documentclass[12pt, border=2bp]{standalone}
\usepackage{unicode-math}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
input mpcolornames;
beginfig(1);
numeric u, r, rho, xmin, xmax, ymin, ymax;
u = 5cm; r = .75u; rho = .15u; z0 = u*(-.25, .25);
xmax = -xmin = 1.25u; ymin = -.25u; ymax = 1.25u;
path circle[], dome[], arrow[], intersect;
dome1 = halfcircle scaled (2r); z1 = point 1 of dome1;
dome2 = halfcircle scaled (2u);
circle1 = fullcircle scaled (2rho) shifted z0;
circle2 = fullcircle rotated 90 scaled (2rho) shifted z1;
intersect = buildcycle(dome1, circle2);
fill dome2 -- cycle withcolor PeachPuff;
fill dome1 -- cycle withcolor PaleTurquoise;
fill intersect withcolor Salmon;
for i = 1,2: draw dome[i]; draw circle[i]; endfor
pickup pencircle scaled 3bp;
drawdot z0 withpen pencircle scaled 3bp;
drawdot z1 withpen pencircle scaled 3bp;
pickup pencircle scaled .5bp;
z2 = point 0.7 of circle1;
draw z0 -- z2;
drawarrow (xmin, 0) -- (xmax, 0);
drawarrow (0, ymin) -- (0, ymax);
label.bot("$x_0$", z0); label.urt("$x_0$", z1);
label.top("$\rho$", .4[z0, z2]);
label.bot("$-1$", (-u, 0)); label.bot("$1$", (u, 0));
label.bot("$-r$", (-r, 0)); label.bot("$r$", (r, 0));
label.rt("$x' \in \mathbb{R}^{N-1}$", (xmax, 0));
label.lft("$x_N$", (0, ymax));
arrow1 = (point 1.5 of dome1){dir 45} .. u*(.8, .9);
drawarrow arrow1 withcolor Gray; label.rt("$I^*(r)$", point 1 of arrow1);
arrow2 = (point 1.5 of dome2){dir 40} .. u*(.9, 1.1);
drawarrow arrow2 withcolor Gray; label.rt("$I^*(1)$", point 1 of arrow2);
endfig;
\end{mplibcode}
\end{document}