Schematic CDW phase diagram. Low-temperature phase diagram of a layered crystal as a function of disorder strength () and CDW strength, , assumed to be an increasing function of increasing H, due to the suppression of the superconductivity. It is assumed that the disorder-free state (marked by the red-colored bar on the x axis) is an incommensurate, unidirectional CDW. In a tetragonal crystal, the thick gray line marks a nematic transition, , whereas in a weakly orthorhombic YBCO crystal it is a cross-over. Above , CDW correlations are short-ranged and bidirectional. Insets show the cartoons of disorder-pinned CDW domains; approximately isotropic, bidirectional, CDW phase (top left) and sharply defined nematic, unidirectional phase (bottom right). In the context of the proposed inhomogeneity scenario, the purple and blue dashed arrows demonstrate the field-dependent CDW evolution in the less () and more () disordered regions of the sample. At a given applied magnetic field (), the region transforms from the bidirectional 2D CDW into the unidirectional 3D CDW order, whereas the region remains in the isotropic phase (see also SI Appendix and SI Appendix, Fig. S1).