The correlation between the mean transverse momentum of outgoing particles, $langle p_t rangle$, and the magnitude of anisotropic flow, $v_n$, has recently been measured in Pb+Pb collisions at the CERN Large Hadron Collider, as a function of the collision centrality. We confirm the previous observation that event-by-event hydrodynamics predicts a correlation between $v_n$ and $langle p_t rangle$ that is similar to that measured in data. We show that the magnitude of this correlation can be directly predicted from the initial condition of the hydrodynamic calculation, for $n=2,3$, if one replaces $v_n$ by the corresponding initial-state anisotropy, $varepsilon_n$, and $langle p_trangle$ by the total energy per unit rapidity of the fluid at the beginning of the hydrodynamic expansion.