Call $A$ an HM-space if there is a continuous surjection $I\to A$ (where $I$ is the closed interval $[0,1]$). Note that if $A$ is an HM-space, then it is path-connected.
Theorem: If $X$ is path-connected, then the following are equivalent:
- $X = \bigcup_{n=1}^\infty A_n$ where each $A_n$ is an HM-space
- there is a continuous surjection $\mathbb{R} \to X$
- there is a continuous surjection $(0,\infty) \to X$
- there is a continuous surjection $[0,\infty) \to X$.
Proof:
Clearly (2) and (3) are equivalent; let's prove (3) implies (1).
If $f:(0,\infty) \to X$ is a continuous surjection, let $A_n = f([n-1,n])$. Then
$A_n$ is evidently an HM-space and $X$ is the indicated countable union.
Now we show (1) implies (4). if $X = \bigcup_{n=1}^\infty A_n$ with each $A_n$ an HM-space, then we can choose surjective paths $\alpha_n: [2(n-1),2n-1]\to A_n$; write $x_n = \alpha_n(0)$ and $y_n= \alpha_n(1)$. Since $X$ is path-connected, we can find paths $\beta_n:[2n-1,2n]\to X$ from $y_n$ to $x_{n+1}$. Concatenating these paths gives the desired surjection $0,\infty) \to X$.
Finally, since there is a continuous surjection $\mathbb{R}\to [0,\infty )$, (4) implies (2).$\quad \square$
Just musing: there is a partial order on spaces defined by $X< Y$ if there is a continuous surjection $Y \to X$. Hahn-Mazurkowicz classifies $\{ X \mid X < I\}$. The equivalence of (2), (3) and (4) shows that half-open intervals are "equivalent" to open ones (i.e., both $(0,1)< [0,1)$ and $[0,1) < (0,1)$); and closed ones are different, being compact. Finally, note that a Peano space (i.e., HM-space) $X$ is "equivalent" in this sense to $I$ if and only if it is the domain of a nonconstant continuous function $f:X\to \mathbb{R}$.