我想blobs
使用 tikz 绘制表示集合的图表,即没有不同形状的对象(这是 的一个定义blob
)。它不必专门使用 tikz:欢迎任何解决方案,它恰好是我所知道的在 LaTeX 中绘制图表的唯一方法。此外,我必须能够将commutative diagrams
包含标准箭头等的绘图放进去,这就是我不得不使用 tikz 的原因。
无论如何,我想创作出如下这样的图画
我如何创建这些“通用形状”?
这是更符合我想要实现的结果的绘图。
中的弯曲线条X
应该表示 中f
所绘点在地图下方的逆像f(X)
,其上的两个点是地图下方左边两个点的像alpha
。
相关问题。
答案1
这是一个MWE
与Asymptote
,
// blobs.asy :
//
size(7cm);
import graph;
import patterns;
import fontsize;
defaultpen(fontsize(9pt));
texpreamble("\usepackage{lmodern}");
pen hatchPen=orange+0.4bp;
pen borderPen=deepblue+1bp;
pen arrPen=red+1bp;
pen areaBG=palegreen;
pair[] dots={
(25,280),
(60,280),
(25,140),
};
pair star=(60,137);
guide[] arrows={(25,265)--(25,160),
(60,265){dir(-90)}..(60,200)..(40,160),
};
guide[] markedArrows={
(150,280)--(200,280),
(150,140)--(200,140),
(360,240)--(360,200),
};
pair[] xArea={
(409,257),
(415,272),
(400,289),
(383,291),
(367,292),
(358,300),
(355,307),
(344,317),
(330,317),
(320,312),
(311,319),
(303,308),
(302,303),
(306,298),
(306,287),
(312,277),
(319,269),
(330,267),
(346,260),
(366,259),
};
pair[] xAreaInside={
(341,272),
(332,282),
(333,301),
(339,312),
(385,270),
};
pair[] yArea={
(379,35),
(398,36),
(422,39),
(453,52),
(468,63),
(484,86),
(478,107),
(453,110),
(426,111),
(393,129),
(361,149),
(349,157),
(335,157),
(323,173),
(303,173),
(283,153),
(267,134),
(266,113),
(280,100),
(297,93),
(313,82),
(329,64),
(341,45),
};
pair[] smallShArea={
(400,41),
(403,46),
(399,51),
(406,58),
(408,66),
(398,63),
(387,59),
(380,57),
(369,62),
(360,57),
(366,48),
(376,46),
(384,48),
};
pair[] bigShArea={
(380,74),
(390,83),
(396,99),
(389,111),
(376,115),
(358,123),
(340,130),
(326,144),
(307,151),
(295,146),
(295,140),
(299,129),
(304,119),
(321,116),
(334,107),
(348,87),
};
pair[] yAreaInside={
(315,136),
(370,97),
(436,85),
(460,82),
};
dot(dots,UnFill);
draw(arrows[0],arrPen,Arrow(HookHead,size=4));
draw(arrows[1],arrPen,Arrow(HookHead,size=4));
for(int i=0;i<markedArrows.length;++i){
draw(markedArrows[i],arrPen,Arrow(HookHead,size=4));
}
filldraw(graph(xArea,operator..)..cycle,areaBG,borderPen);
draw(graph(xAreaInside[0:4],operator..),borderPen);
dot(xAreaInside[1:3],UnFill);
label("$X$",xAreaInside[4]);
filldraw(graph(yArea,operator..)..cycle,areaBG,borderPen);
guide gsmallShArea=graph(smallShArea,operator..)..cycle;
guide gbigShArea=graph(bigShArea,operator..)..cycle;
add("hatch",hatch(1mm,hatchPen));
fill(gsmallShArea,pattern("hatch"));
fill(gbigShArea,pattern("hatch"));
draw(gsmallShArea,borderPen);
draw(gbigShArea,borderPen);
dot(yAreaInside[0],UnFill);
label("$f(X)$",yAreaInside[1]);
label("*",yAreaInside[2]);
label("Y",yAreaInside[3]);
label("$\alpha$",markedArrows[0],N);
label("$\beta$",markedArrows[1],N);
label("$f$",markedArrows[2],E);
label("*",star);
要获得独立的blobs.pdf
,运行asy -f pdf blobs.asy
,它将自动运行pdflatex
来排版标签。
答案2
这应该可以让你开始使用。你可以使用tikz
和hobby
库来绘制斑点。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}
%% Blob
\path[draw,use Hobby shortcut,closed=true]
(0,0) .. (.5,1) .. (1,3) .. (.3,4) .. (-1,2) .. (-1,.5);
\begin{scope}[xshift=4cm]
\draw (0,0) to [quick curve through={(0,0) (.5,1) .. (1,3) .. (.3,4) .. (-1,2)}] (0,0) ;
\end{scope}
%% Curvy line using hobby
\path[draw,-stealth,use Hobby shortcut,closed=false]
(-1.5,0) .. (-2.2,-2.2) .. (-2.8,-3);
\draw[xshift=-.5cm,-stealth] (-1.5,0) to [quick curve through={(-2.2,-2.2)}] (-2.8,-3) ;
%% Cury line without hobby
\path[draw,xshift=.5cm]
(-1.5,0) edge[out=-95,in=45,-stealth] (-2.8,-3);
\path[draw,xshift=1cm,-stealth]
(-1.5,0) to[out=-95,in=45] (-2.8,-3);
\end{tikzpicture}
\end{document}