In a static fluid, the pressure variation is governed by the equation:
\[\frac{dp}{dy} = -Y,\]
where:
$p$ is the pressure,
$y$ is the vertical direction,
$Y$ is the specific weight of the fluid $= \rho g$,
$-$ sign indicates that pressure decreases as we move upward.
The specific weight $Y$ is the product of the fluid density $\rho$ and gravitational acceleration $g$, so the pressure variation depends on both.