TeX - LaTeX Asked on March 12, 2021
How can the following image be coded with tikz
so that the coordinates of the dots can be customized along a domain of 0 to 1 (i.e. fractional real numbers) whenever needed, and so that the arrows will dynamically adjust to any changed to- and from- coordinates? The image illustrates samples (the dots) from a source distribution being re-allocated to a target distribution, with the top half being a better mapping than the one in the lower half. If there’s a proper name for this, I could rename the title
Maybe this could help you starting :
usepackage{tikz}
usetikzlibrary{%
calc,positioning,
quotes,arrows.meta
}
begin{document}
begin{tikzpicture}[x=10cm]
draw[-Latex,thick](0,0)--(1,0);
foreach[var=from, var=to,count=i]in{.2/.4,{1/3}/{sqrt(2)/2},.5/.6}{
node[blue](fromi)at({from},0){$bullet$};
node[red](toi)at({to},0){$bullet$};
draw[-Latex](fromi.north)to[bend left](toi.north);
}
end{tikzpicture}
end{document}
the "from" and "to" points are stored in (from "number") and (to"number") nodes. I think it is self adjusting as you asked if you modify the coordinates (I have used many types of number between 0 and 1, real or rational numbers). It yields :
Maybe you would need to create two lists to achieve your goal since the order of the starting and the ending point on the axis makes the sense of the arrow to change.
Answered by mxnc baud on March 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP