The behavior of water confined at the nanoscale plays a fundamental role in biological processes and technological applications, including protein folding, translocation of water across membranes, and filtration and desalination. Remarkably, nanoscale confinement drastically alters the properties of water. Using molecular dynamics simulations, we determine the phase diagram of water confined by graphene sheets in slab geometry, at T = 300 K and for a wide range of pressures. We find that, depending on the confining dimension D and density σ, water can exist in liquid and vapor phases, or crystallize into monolayer and bilayer square ices, as observed in experiments. Interestingly, depending on D and σ, the crystal-liquid transformation can be a first-order phase transition, or smooth, reminiscent of a supercritical liquid-gas transformation. We also focus on the limit of stability of the liquid relative to the vapor and obtain the cavitation pressure perpendicular to the graphene sheets. Perpendicular cavitation pressure varies non-monotonically with increasing D and exhibits a maximum at D ≈ 0.90 nm (equivalent to three water layers). The effect of nanoconfinement on the cavitation pressure can have an impact on water transport in technological and biological systems. Our study emphasizes the rich and apparently unpredictable behavior of nanoconfined water, which is complex even for graphene.