# Drawing path-connected sets

I´d like to see how can be written using tikz package the following diagrams (I´ve made it using Paint, but I don´t know how using LaTEX).

Picture #1:

Picture #2:

Thank you very much for the support.

Regards,

L

• Could you please add a compilable MWE on what you have tried so far? – Raaja Jan 21 at 16:00

Welcome to TeX.SE! The purpose of this site is to get help when one is stuck, not to get screen shots converted to LaTeX code. For newcomers sometimes exceptions are made. However, I guarantee you that it will be much more fun for you if you tried these things yourself.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.geometric,fit,backgrounds,arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[thick,Bar-Bar] (0,0)node[below=1mm]{$0$} -- (1,0)node[below=1mm]{$1$}
node[midway,above,inner sep=4pt] (M0){};
\draw[thick=1mm] (4,-0.5) node[below] (x) {$x$} to[out=30,in=-120]
(4.5,0) node[inner sep=4pt] (M1){}
to[out=60,in=-150] (5,0.5) node[above] (y) {$y$};
\draw[thick=1mm] (8.75,-0.75) node[below] (fx) {$f(x)$} to[out=45,in=-105]
(9,0) node[inner sep=4pt] (M2){}
to[out=75,in=-135] (9.25,0.57) node[above] (fy) {$f(y)$};
\draw[-latex] (M0) to[bend left] node[midway,above]{$\alpha$} (M1);
\draw[-latex] (M1) to[bend left] node[midway,above]{$f$} (M2);
\draw[-latex] (M0) to[bend right=50] node[midway,below]{$f\circ\alpha$} (M2);
\begin{scope}[on background layer]
\node[draw,circle,fill=gray,fit=(x) (y),label=45:$X$]{};
\node[draw,circle,fill=gray,fit=(fx) (fy),label=45:$Y$]{};
\end{scope}
\end{tikzpicture}

\begin{tikzpicture}[elli/.style={ellipse,draw,thick,fill=gray,fill
opacity=0.5,minimum width=6cm,minimum height=2cm}]
\node[elli,label=150:$A$] (A) at(0,0) {};
\node[elli,label=30:$B$] (B) at (pi,0.2) {};
\draw[thick] (-2,0) node[left]{$x$} to[out=20,in=135]
node[pos=0.6,above] {$\alpha_0$} (-0.5,0)
to[out=-45,in=-165] (pi/2,0.1) node[below]{$z$}
to[out=15,in=160] node[midway,above]{$\alpha_1$}
(4.5,0.2) node[right]{$y$};
\end{tikzpicture}
\end{document}