我怎样才能在已经很拥挤的图形中放置更多节点?以下是预期结果:
这是我现在的数据:
我希望添加速度矢量符号和(t_f < t_m)
大于和小于的时间符号。
如何在已经拥挤的图形中添加剩余的节点?
如果您需要查看代码,我也可以发布它。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections, calc, arrows, decorations.markings, backgrounds}
\tikzset{
invclip/.style={
clip,
insert path={
(-520pt, -520pt) rectangle (520pt, 520pt)
}
}
}
\begin{document}
\begin{tikzpicture}[scale = 1.75,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.6789}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\pgfmathsetmacro{\angle}{88.23}
\draw[dashed, rotate = \angle] (-\a + \ctilde, 0) -- (\a + \ctilde, 0);
\draw[dashed] (-\a - \c, 0) -- (\a - \c, 0);
\node[font = \scriptsize, fill = orange, big dot = {below: \(F\)}] (F)
at (0, 0) {};
\node[font = \scriptsize, fill = white, big dot = {below: \(F^*\)}] (FS)
at (-2 * \c cm, 0) {};
\path[name path global = ecc2768] (-\c, 0) ellipse[x radius = \a cm,
y radius = \b cm];
\draw[red, name path = r2] (0, 0) circle[radius = 1.523679cm];
\draw[blue, name path = r1] (0, 0) circle[radius = 1cm];
\draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
node[fill, big dot = {right: \(P_1\)}] (P1) {};
\draw[name intersections = {of = ecc2768 and r2}] (F) -- (intersection-1)
node[fill, big dot = {above left: \(P_2\)}] (P2) {};
\draw[draw = none] (P1) -- (F) node[font = \scriptsize, pos = .5,
fill = white, inner sep = 0cm] {\(r_1\)};
\draw[draw = none] (P2) -- (F) node[font = \scriptsize, pos = .5,
fill = white, inner sep = 0cm] {\(r_2\)};
\draw (P1) -- (P2) node[font = \scriptsize, fill = white, inner sep = 0cm,
pos = .5] {\(c\)};
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.7 with {\arrow{latex reversed}}
}]
\path[invclip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw[name path global = ecc2768, postaction = decorate] (-\c, 0)
ellipse [x radius = \a cm, y radius = \b cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\draw let
\p0 = (F),
\p1 = (P1),
\p2 = (P2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.35cm},
\n4 = {(\n1 + \n2) / 2}
in (F) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[font = \scriptsize, fill = white, inner sep = 0cm] at
([shift = (F)] \n4:.5cm) {\pgfmathparse{\n2 - \n1}%
$\pgfmathprintnumber{\pgfmathresult}^{\circ}$
};
\path[name path = aux1] (P1) circle[radius = 1bp];
\draw[name intersections = {of = ecc2768 and aux1}, latex-]
($(intersection-2)!.75cm!(intersection-1)$) -- (P1);
\path[name path = aux2] (P2) circle[radius = 1bp];
\draw[name intersections = {of = ecc2768 and aux2}, -latex]
(P2) -- ($(intersection-1)!.75cm!(intersection-2)$);
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{latex reversed}}
}]
\path[name path global = ecc6789unrotated] (\ctilde, 0) ellipse
(\a cm and \btilde cm);
\path[invclip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [name intersections = {of = r1 and ecc6789unrotated},
postaction = decorate] (intersection-2) let
\p0 = (F),
\p1 = (P1),
\p2 = (intersection-2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {\n1 - \n2}
in \pgfextra{\xdef\myangle{\n3}} [rotate = \n3,
name path global = ecc6789rotated] (\ctilde, 0) ellipse
[x radius = \a cm, y radius = \btilde cm];
% \node at (0,3) {The angle of rotation is: \pgfmathparse{\myangle}
% $\pgfmathprintnumber{\pgfmathresult}^\circ$};
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\begin{scope}[rotate around = {\myangle: (0, 0)}]
\node[font = \scriptsize, fill = white, big dot = {left: \(\tilde{F}^*\)}]
(FST) at (2 * \ctilde cm, 0) {};
\end{scope}
\draw[name intersections = {of = ecc6789rotated and aux1}, -latex] (P1) --
($(intersection-2)!.75cm!(intersection-1)$);
\draw[name intersections = {of = ecc6789rotated and aux2}, -latex] (P2) --
($(intersection-1)!.75cm!(intersection-2)$);
\begin{pgfinterruptboundingbox}
% To prevent the clipping path from making our picture larger
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.2 with {\arrow{latex}},
}]
\path[clip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [orange, postaction = decorate] (-\c, 0) ellipse
[x radius = \a cm, y radius = \b cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\begin{pgfinterruptboundingbox}
% To prevent the clipping path from making our picture larger
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0 with {\arrow{latex}},
}]
\path[clip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [name intersections = {of = r1 and ecc6789unrotated},
postaction = decorate, PineGreen] (intersection-2)
let
\p0 = (F),
\p1 = (P1),
\p2 = (intersection-2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {\n1 - \n2}
in \pgfextra{\xdef\myangle{\n3}} [rotate = \n3,
name path global = ecc6789rotated] (\ctilde, 0) ellipse
[x radius = \a cm, y radius = \btilde cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\end{tikzpicture}
\end{document}
答案1
也许不是您想要的,但我使用了stackengine
的\stackinset
宏来覆盖您用剩余标签所做的操作。所有“操作”都在我的 MWE 底部,并且超出了环境范围tikz
。
stackengine
已更新以反映包的更现代语法,使用\stackinset
而不是弃用的\bottominset
宏。(此外,tikz
atan2 宏改变了语法)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections, calc, arrows, decorations.markings, backgrounds}
\tikzset{
invclip/.style={
clip,
insert path={
(-520pt, -520pt) rectangle (520pt, 520pt)
}
}
}
\usepackage{stackengine}
\begin{document}
\newsavebox{\mypic}
\sbox{\mypic}{%
\begin{tikzpicture}[scale = 1.75,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.6789}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\pgfmathsetmacro{\angle}{88.23}
\draw[dashed, rotate = \angle] (-\a + \ctilde, 0) -- (\a + \ctilde, 0);
\draw[dashed] (-\a - \c, 0) -- (\a - \c, 0);
\node[font = \scriptsize, fill = orange, big dot = {below: \(F\)}] (F)
at (0, 0) {};
\node[font = \scriptsize, fill = white, big dot = {below: \(F^*\)}] (FS)
at (-2 * \c cm, 0) {};
\path[name path global = ecc2768] (-\c, 0) ellipse[x radius = \a cm,
y radius = \b cm];
\draw[red, name path = r2] (0, 0) circle[radius = 1.523679cm];
\draw[blue, name path = r1] (0, 0) circle[radius = 1cm];
\draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
node[fill, big dot = {right: \(P_1\)}] (P1) {};
\draw[name intersections = {of = ecc2768 and r2}] (F) -- (intersection-1)
node[fill, big dot = {above left: \(P_2\)}] (P2) {};
\draw[draw = none] (P1) -- (F) node[font = \scriptsize, pos = .5,
fill = white, inner sep = 0cm] {\(r_1\)};
\draw[draw = none] (P2) -- (F) node[font = \scriptsize, pos = .5,
fill = white, inner sep = 0cm] {\(r_2\)};
\draw (P1) -- (P2) node[font = \scriptsize, fill = white, inner sep = 0cm,
pos = .5] {\(c\)};
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.7 with {\arrow{latex reversed}}
}]
\path[invclip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw[name path global = ecc2768, postaction = decorate] (-\c, 0)
ellipse [x radius = \a cm, y radius = \b cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\draw let
\p0 = (F),
\p1 = (P1),
\p2 = (P2),
\n1 = {atan2(\y1 - \y0, \x1 - \x0)},
\n2 = {atan2(\y2 - \y0, \x2 - \x0)},
\n3 = {.35cm},
\n4 = {(\n1 + \n2) / 2}
in (F) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[font = \scriptsize, fill = white, inner sep = 0cm] at
([shift = (F)] \n4:.5cm) {\pgfmathparse{\n2 - \n1}%
$\pgfmathprintnumber{\pgfmathresult}^{\circ}$
};
\path[name path = aux1] (P1) circle[radius = 1bp];
\draw[name intersections = {of = ecc2768 and aux1}, latex-]
($(intersection-2)!.75cm!(intersection-1)$) -- (P1);
\path[name path = aux2] (P2) circle[radius = 1bp];
\draw[name intersections = {of = ecc2768 and aux2}, -latex]
(P2) -- ($(intersection-1)!.75cm!(intersection-2)$);
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{latex reversed}}
}]
\path[name path global = ecc6789unrotated] (\ctilde, 0) ellipse
(\a cm and \btilde cm);
\path[invclip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [name intersections = {of = r1 and ecc6789unrotated},
postaction = decorate] (intersection-2) let
\p0 = (F),
\p1 = (P1),
\p2 = (intersection-2),
\n1 = {atan2(\y1 - \y0, \x1 - \x0)},
\n2 = {atan2(\y2 - \y0, \x2 - \x0)},
\n3 = {\n1 - \n2}
in \pgfextra{\xdef\myangle{\n3}} [rotate = \n3,
name path global = ecc6789rotated] (\ctilde, 0) ellipse
[x radius = \a cm, y radius = \btilde cm];
% \node at (0,3) {The angle of rotation is: \pgfmathparse{\myangle}
% $\pgfmathprintnumber{\pgfmathresult}^\circ$};
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\begin{scope}[rotate around = {\myangle: (0, 0)}]
\node[font = \scriptsize, fill = white, big dot = {left: \(\tilde{F}^*\)}]
(FST) at (2 * \ctilde cm, 0) {};
\end{scope}
\draw[name intersections = {of = ecc6789rotated and aux1}, -latex] (P1) --
($(intersection-2)!.75cm!(intersection-1)$);
\draw[name intersections = {of = ecc6789rotated and aux2}, -latex] (P2) --
($(intersection-1)!.75cm!(intersection-2)$);
\begin{pgfinterruptboundingbox}
% To prevent the clipping path from making our picture larger
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.2 with {\arrow{latex}},
}]
\path[clip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [orange, postaction = decorate] (-\c, 0) ellipse
[x radius = \a cm, y radius = \b cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\begin{pgfinterruptboundingbox}
% To prevent the clipping path from making our picture larger
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0 with {\arrow{latex}},
}]
\path[clip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [name intersections = {of = r1 and ecc6789unrotated},
postaction = decorate%, PineGreen
](intersection-2)
let
\p0 = (F),
\p1 = (P1),
\p2 = (intersection-2),
\n1 = {atan2(\y1 - \y0, \x1 - \x0)},
\n2 = {atan2(\y2 - \y0, \x2 - \x0)},
\n3 = {\n1 - \n2}
in \pgfextra{\xdef\myangle{\n3}} [rotate = \n3,
name path global = ecc6789rotated] (\ctilde, 0) ellipse
[x radius = \a cm, y radius = \btilde cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\end{tikzpicture}%
}
\stackMath
\stackinset{l}{4.97cm}{b}{3.75cm}{v'_1}{%
\stackinset{l}{4.35cm}{b}{4.4cm}{v_1}{%
\stackinset{l}{0.8cm}{b}{3.3cm}{v'_2}{%
\stackinset{l}{0.1cm}{b}{4.4cm}{v_2}{%
\stackinset{l}{2.3cm}{b}{1.55cm}{\scriptstyle(t_f < t_m)}{%
\stackinset{l}{1.9cm}{b}{5.35cm}{\scriptstyle(t_f < t_m)}{%
\stackinset{l}{4.0cm}{b}{6.4cm}{\scriptstyle(t'_f > t_m)}{%
\stackinset{l}{1.65cm}{b}{4.55cm}{\scriptstyle(t'_f > t_m)}{%
\stackinset{l}{0.3cm}{b}{0.3cm}{\scriptstyle(t'_f > t_m)}{%
\usebox{\mypic}}%
}}}}}}}}
\end{document}
ps 顺便说一句,tikz 不喜欢你的“PineGreen”说明符,所以我将其注释掉了。