4 simplified

There exist connected affine schemes which are not path connected. Let E be a compact connected metric space* which is not path connected (e.g., the closed topologist's sine curve) and consider the following.

$X={\rm Spec}(A)$ where $A$ is the ring of continuous functions $f\colon E\to\mathbb{R}$.

Then X is connected, since any idempotent f satisfies $f(x)\in\{0,1\}$ and, by connectedness of E, $f=0$ or $f=1$. The maximal ideals of A are $$\mathcal{m}_x=\left\{f\in A\colon f(x)=0\right\}$$ for $x\in E$. There will also non-maximal primes (see this question for example) but, every prime ideal will be contained in one and only one of the maximal ideals**. So, we can define $\pi\colon X\to E$ by $\pi(\mathcal{p})=x$ for prime ideals $\mathcal{p}\subseteq\mathcal{m}_x$.

In fact, $\pi$ is continuous, using the following argument. For any open ball $B_r(x)$ in E, choose $f\in A$ to be positive on $B_r(x)$ and zero elsewhere. Then $D_f=\left\{\mathcal{p}\in X\colon f\not\in \mathcal{p}\right\}$ is open and $\pi^{-1}(B_r(x))\subseteq D_f\subseteq \pi^{-1}(\bar B_r(x))$. Writing $B_r(x)=\cup_{s < r}B_s(x)=\cup_{s < r}\bar B_s(x)$, this shows that there are open sets $U_s$ lying between $\pi^{-1}(B_s(x))$ and $\pi^{-1}(\bar B_s(x))$. So, $\pi^{-1}(B_r(x))=\bigcup_{s < r} U_s$ is open, and $\pi$ is continuous.

So, $\pi\colon X\to E$ is continuous and onto. If X was path connected then E would be too.

It may be worth noting that ${\rm Specm}(A)$ is also connected but not path connected, being homeomorphic to E.

(*) I assume that E is a metric space in this argument so that the open balls give a basis for the topology, and there are continuous $f\colon E\to\mathbb{R}$ which are nonzero precisely on any given open ball. Actually, it is enough for the topology to be generated by the continuous real-valued functions. So the argument generalizes to any compact Hausdorff space (+ connected and not path connected, of course).

(**) Maybe I should give a proof of the fact that every prime $\mathcal{p}$ is contained in precisely one of the maximal ideals $\mathcal{m}_x$. Let $V(f)=\{x\in E\colon f(x)=0\}$ be the zero set of f. Then, $V(\mathcal{p})\equiv\bigcap\{V(f)\colon f\in\mathcal{p}\}$ will be non-empty. Otherwise, by compactness, there will be $f_1,f_2,\ldots,f_n\in\mathcal{p}$ with $V(f_1)\cap V(f_2)\cap\cdots\cap V(f_n)=\emptyset$. Then, $f=f_1^2+f_2^2+\cdots+f_n^2\in\mathcal{p}$ would be nonzero everywhere, so a unit, contradicting the condition that $\mathcal{p}$ is a proper ideal. Choosing $x\in V(\mathcal{p})$ gives $\mathcal{p}\subseteq\mathcal{m}_x$.

On the other hand, we cannot have $\mathcal{p}\subseteq\mathcal{m}_x\cap\mathcal{m}_y$ for $x\not=y$. That would give $f(x)=f(y)=0$ for any $f\in\mathcal{p}$. Then, letting Letting $u,v\in f,g\in X$ have disjoint supports with $u(x)\not=0,v(y)\not=0$ f(x)\not=0, g(y)\not=0$gives$(f+u)(f+v)=(f+u+v)f\in\mathcal{p}$fg=0\in\mathcal{p}$ and, as it $\mathcal{p}$ is a primeideal, $f+u\in\mathcal{p}\setminus\mathcal{m}_x$ f\in\mathcal{p}\setminus\mathcal{m}_x$or$f+v\in\mathcal{p}\setminus\mathcal{m}_y$.g\in\mathcal{p}\setminus\mathcal{m}_y$.

There exist connected affine schemes which are not path connected. Let E be a compact connected metric space* which is not path connected (e.g., the closed topologist's sine curve) and consider the following.

for $x\in E$. There will also non-maximal primes (see this question for example) but, every prime ideal will be contained in one and only one of the maximal idealsideals**. So, we can define $\pi\colon X\to E$ by $\pi(\mathcal{p})=x$ for prime ideals $\mathcal{p}\subseteq\mathcal{m}_x$.

It may be worth noting that ${\rm Specm}(A)$ is also connected but not path connected, being homeomorphic to E.

(*) I assume that E is a metric space in this argument so that the open balls give a basis for the topology, and there are continuous $f\colon E\to\mathbb{R}$ which are nonzero precisely on any given open ball. Actually, it is enough for the topology to be generated by the continuous real-valued functions. So the argument generalizes to any compact Hausdorff space (+ connected and not path connected, of course).

(**) Maybe I should give a proof of the fact that every prime $\mathcal{p}$ is contained in precisely one of the maximal ideals $\mathcal{m}_x$. Let $V(f)=\{x\in E\colon f(x)=0\}$ be the zero set of f. Then, $V(\mathcal{p})\equiv\bigcap\{V(f)\colon f\in\mathcal{p}\}$ will be non-empty. Otherwise, by compactness, there will be $f_1,f_2,\ldots,f_n\in\mathcal{p}$ with $V(f_1)\cap V(f_2)\cap\cdots\cap V(f_n)=\emptyset$. Then, $f=f_1^2+f_2^2+\cdots+f_n^2\in\mathcal{p}$ would be nonzero everywhere, so a unit, contradicting the condition that $\mathcal{p}$ is a proper ideal. Choosing $x\in V(\mathcal{p})$ gives $\mathcal{p}\subseteq\mathcal{m}_x$.

On the other hand, we cannot have $\mathcal{p}\subseteq\mathcal{m}_x\cap\mathcal{m}_y$ for $x\not=y$. That would give $f(x)=f(y)=0$ for any $f\in\mathcal{p}$. Then, letting $u,v\in X$ have disjoint supports with $u(x)\not=0,v(y)\not=0$ gives $(f+u)(f+v)=(f+u+v)f\in\mathcal{p}$ and, as it is a prime ideal, $f+u\in\mathcal{p}\setminus\mathcal{m}_x$ or $f+v\in\mathcal{p}\setminus\mathcal{m}_y$.

2 small fix and mention Specm

There exist connected affine schemes which are not path connected. Let E be a compact connected metric space which is not path connected (e.g., the topologists closed topologist's sine curve) and consider the following.

$X={\rm Spec}(A)$ where $A$ is the ring of continuous functions $f\colon E\to\mathbb{R}$.

Then X is connected, since any idempotent f satisfies $f(x)\in\{0,1\}$ and, by connectedness of E, $f=0$ or $f=1$. The maximal ideals of A are $$\mathcal{m}_x=\left\{f\in A\colon f(x)=0\right\}$$ for $x\in E$. There will also non-maximal primes (see this question for example) but, every prime ideal will be contained in one and only one of the maximal ideals. So, we can define $\pi\colon X\to E$ by $\pi(\mathcal{p})=x$ for prime ideals $\mathcal{p}\subseteq\mathcal{m}_x$.

In fact, $\pi$ is continuous, using the following argument. For any open ball $B_r(x)$ in E, choose $f\in A$ to be positive on $B_r(x)$ and zero elsewhere. Then $D_f=\left\{\mathcal{p}\in X\colon f\not\in \mathcal{p}\right\}$ is open and $\pi^{-1}(B_r(x))\subseteq D_f\subseteq \pi^{-1}(\bar B_r(x))$. Writing $B_r(x)=\cup_{s < r}B_s(x)=\cup_{s < r}\bar B_s(x)$, this shows that there are open sets $U_s$ lying between $\pi^{-1}(B_s(x))$ and $\pi^{-1}(\bar B_s(x))$. So, $\pi^{-1}(B_r(x))=\bigcup_{s < r} U_s$ is open, and $\pi$ is continuous.

So, $\pi\colon X\to E$ is continuous and onto. If X was path connected then it E would follow be too.

It may be worth noting that E ${\rm Specm}(A)$ is also connected but not path connected, being homeomorphic to E.

1