Irreducible Subsets of Ringed Spaces

Let $$(X,\mathcal{O}_X)$$ be a quasi-compact ringed space which is locally isomorphic to an affine variety.

Is it true then that $$(X,\mathcal{O}_X)$$ is always locally isomorphic to an irreducible affine variety?

Intuitively I'd like to say yes, if we take $$x\in X$$ then we have some open $$U\subseteq X$$ with $$x\in U$$ and $$(U,\mathcal{O}_X)\cong(V,\mathcal{O}_V)$$ for some affine $$V$$ via an isomorphism $$\varphi$$. We can then find some closed irreducible $$W\subseteq V$$ with $$\varphi(x)\in W$$, but then $$\varphi^{-1}(W)$$ is not necessarily open in $$X$$, and I can't seem to find a useful open set related to it.

However on the other hand I'm struggling to come up with a counterexample, any help would be much appreciated.

• I guess you could further pass to a distinguished open affine of $W$ (open subsets of irreducible sets are again irreducible)? – Jane Doé May 4 at 5:37
• @JaneDoé Would we not need our open set of $A\subseteq W$ to be open in $V$ then also? If it were, and if $(A,\mathcal(O)_W)$ were isomorphic to an irreducible affine variety then we could take our open set in $X$ to be $\varphi^{-1}(A)$, but I’m not sure we can do this if $A$ isn’t open in $V$? – Dave May 4 at 6:28
• Ah having given it some more thought I think the statement is false. If we take the affine variety $V(XY)$, this will be the union of two lines meeting only at $0$. Then if we take $x=0$, any open set containing $x$ must just be $V(XY)$ minus a finite set of points. Say this open set is isomorphic to an affine variety $W$ by $\psi$, then $W=\psi(V(X))\cup\psi(V(Y))$. These sets will both be closed in $W$ and so it can’t be irreducible. Apologies for not spotting this earlier. – Dave May 4 at 7:03

If we take our space to be $$V(XY)$$ over some field $$k$$, this will be two lines meeting only at $$(0,0)$$. Taking $$x=(0,0)$$, any open set containing $$x$$ will just be $$V(XY)$$ minus a finite set of points. If this open set is isomorphic via a map $$\psi$$ to some affine $$W$$, then we would have $$W=\psi(V(X))\cup\psi(V(Y))$$. These sets are both closed, non-empty, and neither can be equal to the whole of $$W$$, and so $$W$$ cannot be irreducible.