Maximum and minimum gas giant & ice giant densities I'm working on a star system generator for a game; I'd like its results to be plausible but they needn't be super-realistic. I've got the orbital distances and masses of each body in the system, and now want to render them, so I need to determine the radius of each body.

For gas giant and ice giant planets, what's the relationship between mass and density? What are the minimum and maximum densities expected?
Here is a plot I generated in 5 minutes at the site exoplanets.org

To construct this I took planets discovered by the transit method and which had a $M \sin i$ measured using radial velocities. I divided the $M \sin i$ by the sine of the measured inclination angle (this is required to avoid using masses that have been estimated using an assumed mass-radius relation). The y-axis is density, which comes directly (and quite precisely) from transit measurements. Of course transiting planets are the only ones with radii and density measurements.

You have to do this to avoid some very uncertain values that are given for planetary masses that have been simply assumed from a theoretical mass-radius relationship.

As you can see, there is a wide spread (factor of three) in density at a given mass for hot Jupiter's (most of the transiting giant planets are hot Jupiters), but there is a strong correlation. The density is at a minimum for a few tenths of Jupiter mass, but then smaller planets (presumably rocky and icy, rather than gas giants) appear to show higher densities.

Remember, these are all transiting exoplanets, and therefore predominantly orbiting close to their parent stars. There could be biases and selection effects at work! For example although the cores of gas giants are governed by degeneracy pressure and this makes the theoretical mass-radius relationship quite flat, there is the perturbing effect of radiation from the parent star ("insolation") that can make some objects larger. Even beyond this there appears to be scatter that is difficult to understand.



EDIT: For an easy-to-use empirical formulation you could try the relationships proposed by the Planetary Habitability Laboratory.