Continuity and path-connectedness For a function $f:D\subseteq\mathbb R\rightarrow\mathbb R$, let's define :


*

*the embedded domain $\hat{D}:=\{(x,0)\in\mathbb R^2\ |\ x\in D\}$,

*the graph $G:=\{(x,f(x))\in\mathbb R^2\ |\ x\in D\}$.


Consider then the function $\hat{f}:\hat{D}\rightarrow G:(x,0)\mapsto(x,f(x))$.
A well know result in topology implies that if $f$ is continuous, then $\hat{f}$ sends any connected component of $\hat{D}$ to a connected component of $G$. The converse is not true : for example, the function $f$ defined by $f(x)=\sin(1/x)$ if $x\neq 0$ and $f(0)=0$ is not continuous (on $\mathbb R$), although its graph is connected.
But does the converse become true if we consider path-connectedness ? In other words, do we have that : $f$ is continuous if and only if $\hat{f}$ sends any path-connected component of $\hat{D}$ to a path-connected component of $G$ ? I can't think of any counter-example.
(Remark that the first component of $\hat{f}$ is just the identity function.)
Edit (following Paul Frost's answer) :
Thank you for your great answer.
I'll try to express the condition on the domain $D$ that makes the converse become true (preservation of path-connected components $\Rightarrow$ continuity).
Let's define a jump-limit-point of $D$ to be a limit point $x$ for which there exists a sequence $(x_n)_{n\in\mathbb R}$ that converges to $x$ and such that for all $n$, there exists a $d\notin D$ such that $x_n<d<x_{n+1}$. Thus a jump-limit-point of $D$ is a limit-point that we can reach by "jumping" over areas outside of $D$.
Then the theorem is : if $D\subseteq\mathbb R$ has no jump-limit-point, then a function $f:D\rightarrow\mathbb R$ is continuous iff $\hat{f}$ sends any path-connected component to a path-connected component.
I hope everything is correct now.
 A: The maps $p_1 : G \to  D, p_1(x,y) = x$, and $p_2 : G \to  \mathbb{R}, p_2(x,y) = y$, are continuous (as restrictions of the coordinate projections  $\pi_i : \mathbb{R}^2 \to \mathbb{R}$). Note that $p_1$ is a bijection and $f = p_2 \circ p_1^{-1}$.
(a) Let us first consider the case that $D = [a,b]$ is a closed interval. Assume that $G$ is path connected. Then there exists a continuous map $u : [0,1] \to G$ such that $u(0) = \hat{f}(a)$ and $u(1) = \hat{f}(b)$. The map $u_1 = p_1 \circ u :  [0,1] \to  [a,b]$ is continuous, therefore $u_1([0,1])$ is connected, hence a subinterval of $[a,b]$. Since $u_1(0) = a, u_1(1) = b$, we see that $u_1([0,1]) = [a,b]$. This implies $u([0,1]) = G$. Hence $G$ is compact so that $p_1$ is a homeomorphism. This shows that $f = p_2 \circ p_1^{-1}$ is continuous.
(b) Let us next consider the case that $D$ is path connected, i.e. an arbitrary interval with "boundary" points $c,d$, where $c = -\infty$ and $d = \infty$ are allowed. For each $x \in D$ we find a closed interval $[a,b] \subset D$ such that either $x \in (a,b)$ or $x = a = c$ or $x = b = d$. Then we know from (a) that $f \mid_{[a,b]}$ is continuous, i.e. $f$ is contiuous in each $x \in D$.
(c) Finally consider an arbitrary $D$. Its path components are intervals (possibly degenerated to points). Then $f$ is continuous on all path components $P$ which have an open neighborhood meeting no other path component (in particular on all $P$ which are open intervals). If $D$ has a path component $P$ such that each open neigborhood meets another path component $P'$, we can find a function $f : D \to \mathbb{R}$ which is not continuous on $P$. $P$ must be a closed or half open interval. Let us consider the case $P = [a,b]$, the other cases are similar. For each $n$ there exists a component $P_n \ne P$ such that $P_n \cap (a-1/n,b+1/n) \ne \emptyset$. This allows to find $x_n \in P_n$ such that $(x_n)$ clusters at $a$ or $b$. Define $f : D \to \mathbb{R}$ by $f(x) = 1$ for $x \in P_n$ and $f(x) = 0$ else. Clearly $f$ maps path components of $D$ to path components of $G$, but by construction is not continuous in $a$ or in $b$.
Edit 1 : In (b) we used that the following are equivalent:
(1) $\hat{f}$ sends each path component of $D$ to a path component of $G$.
(2)  $\hat{f}$ sends each path connected subset of $D$ to a path connected subset of $G$.
(2) $\Rightarrow$ (1) : If $P$ is a path component of $D$ and $C$ is the path component of $G$ containing $\hat{f}(P)$, then $p_1(C)$ is path connected set containing $P$, hence $p_1(C) = P$ which implies $C = \hat{f}(P)$.
(1) $\Rightarrow$ (2) : Let $A \subset D$ be path connected and $P$ be the path component of $D$ containing $A$. Then $\hat{f}(P)$ is a path component
 of $G$. Let $a, b \in A$ such that $a < b$. There is a path $u : [0,1] \to \hat{f}(P)$ such that $u(0) = \hat{f}(a), u(1) = \hat{f}(b)$. Let $r = \sup \{t \in [0,1] \mid p_1(u(t)) \le a \}$. We have $0 \le r < 1$ and $p_1(u(r)) = a$ and $p_1(u(t)) \ge a$ for $t \in [r,1]$. Let $s = \inf \{t \in [r,1] \mid p_1(u(t)) \ge b \}$. We have $r < s \le 1$ and $p_1(u(s)) = b$ and $p_1(u(t)) \le b$ for $t \in [r,s]$. Then $u \mid_{[r,s]}$ is a path in $\hat{f}(A)$ connecting $a$ and $b$.
Edit 2: Let us call a function $f : D \to \mathbb{R}$ a pc-function if $\hat{f}$ sends path components of $\hat{D}$ to path components of $G$.
We have shown that if $f$ is a pc-function, then the restriction $f \mid_P$ is continuous for each path component $P$ of $D$.
Let us now consider the following more general situation: Given a space $X$ and a partition $\mathcal{P} = \{ P_\alpha \}$ of $X$ into pairwise disjpoint subspaces $P_\alpha$. A function $f : X \to Y$ is called $\mathcal{P}$-continuous if $f \mid_{P_\alpha}$ is continuous for each $\alpha$. pc-functions are a special case of this.
Under what conditions can we conclude that any $\mathcal{P}$-continuous $f : X \to Y$ is continuous?
We shall show is true if and only if all $P_\alpha$ are open in $X$. 
The latter condition is obviuosly sufficient.
Conversely assume that there exists an $\alpha_0$ such that $P_{\alpha_0}$ is not open. Then for any space $Y$ having more than one point and having one point $y$ such that $\{ y \}$ is closed there exists a $\mathcal{P}$-continuous $f : X \to Y$ which is not continuous. To see this, let $y' \in Y \setminus \{ y \}$ and define $f : X \to Y, f(x) = y'$ for $x \in P_{\alpha_0}$, $f(x)  = y$ for $x \notin P_{\alpha_0}$. Then $f$ is $\mathcal{P}$-continuous, but since $f^{-1}(\{ y \}) = X \setminus P_{\alpha_0}$ is not closed, $f$ is not continuous.
Coming back to pc-functions, we conclude the following:
All pc-functions are continuous if and only if all path components of $D$ are open in $D$.
There are various characterizations of such $D$. Equivalent requirements are
(1) $D$ is locally connected.
(2) $D$ is locally pathwise connected.
(3) $D$ has no jump-limit-points.
