I'm trying to randomly generate a representation of a galaxy.

I have some Idea on the spatial distribution of stars within a galaxy, and I can find plenty of material on the colour of stars, but nothing that seems to give either the distribution of numbers of stars by colour or (if any exists) spatial distribution by colour.

Are there any models for distribution of the colour of stars in a galaxy either by frequency or by location within a galaxy? What do these models depend on? galaxy age? type of shape of galaxy?

  • $\begingroup$ Am not an astronomer, seems like an interesting question. The underlying distribution is by stellar class. Yes, you need age of the galaxy, and you can start looking for papers at arxiv, e.g.: arxiv.org/abs/0811.2085, arxiv.org/abs/0811.2083 - results of this search $\endgroup$ Jun 2, 2013 at 12:27
  • $\begingroup$ "What do these models depend on? galaxy age? type of shape of galaxy?" Both. In part because structure depends somewhat on age. $\endgroup$ Jun 3, 2013 at 0:06
  • $\begingroup$ I think you need an Morgan-Keenan-Diagram of a Galaxy. That will give you brightness and color of all the stars in a scatter plot. $\endgroup$ Jun 3, 2013 at 17:56

1 Answer 1


The color of a star depends on its mass and temperature. The distribution of these also depends on the age of the galaxy. When the galaxy is very young, there are large amounts of gas still available for star formation, and many young, heavy, hot stars mean that the galaxy is very bright and shines in bluer light. This can be seen as an analogy of the quick flare just when you strike a match. These stars have a short life span and soon die, and as they quickly spend a large part of the available gas in the galaxy, the star formation activity decreases.

With lower star formation and the most of the very massive stars already gone in a fireworks of supernovas, the older galaxy appears redder. This partly due to the fewer blue stars, but also because many more of the low-mass red dwarfs - which form slower but live much longer than the massive, bright blue ones - have accumulated. The galaxy also gets a growing contribution from the heavier main-sequence stars turning into red giants, but this contribution is quite small not always so small, it turns out (*).

How this evolution is going is quite complicated. There are some pretty well-trusted models for the mass distributions of stars in young, star-forming galaxies, called the initial mass function. So the one simplified approach could be to draw a random sample from this distribution and from their masses determine their spectral type and hence their color. But this distribution is only valid at age zero; the mass and hence color distribution is subject to significant evolution over time. Unfortunately, this evolution is not simple, and much of it is still unknown. We don't know, for example, if young galaxies have a period of steady star formation, form most of their massive stars in a single or a series of bursts, or something else.

Also, the evolution is not smooth, as collisions and mergers between galaxies have a heavy influence on Star Formation Rates and hence mass and color distribution. Such collisions and mergers have been found to be very common in the local Universe, and probably much more so in the early Universe.

We can say one thing, though: the Milky Way stellar mass distribution seems to be relatively typical for galaxies at our stage of evolution; that is, a medium-large spiral galaxy with a steady but not strong star formation activity. Later, the Milky Way is likely to merge with first Andromeda and later other galaxies, which will probably trigger more star bursts and later deprive the new supergalaxy of almost all its gas. At this point, it will become an elliptical galaxy with few blue stars and many more red stars, and much less dust and gas than it has today.

So, to answer the question:

You first need to determine what type of galaxy you want. If you want a young, star forming galaxy, one of the initial mass function mentioned on Wikipedia should be just fine, and this will also be the simplest solution. If you want smaller starburst galaxies, gas-rich Milky Way-type galaxies or large, red, gas-poor elliptical galaxies, you should probably try searching the literature for mass functions to use - see for example

A. Tamm, E. Tempel, P. Tenjes, O. Tihhonova, T. Tuvikene. Stellar mass map and dark matter distribution in M31. Astron. Astrophys. (accepted). arXiv:1208.5712 [astro-ph.CO].

Once you have found your mass function, I'd draw a random sample from this, and from the masses determine the spectral type. This is actually not possible to do without a full-fledged numerical stellar model, but if you limit yourself to main-sequence stars, there are some approximations you can use here and in the Wikipedia entry for the mass-luminosity relation. This should (although I haven't had the time to double check) give you the temperature of the star from the mass, from which you can infer the color by using Wien's displacement law.

In short, there is no easy way to do what you want, but I hope I have sketched a way to do it not-too-wrong.

(*) From a remark from a professor at our department during a Ph. D. Thesis defense today.


This paper seems to have something that could be practically useful as to the evolution of the Mass Function (i.e. the mass distribution) over time. This is for galaxy clusters, not for individual galaxies, so the result is, you could say, "unrealistically typical", but should be a good start:

Guido De Marchi, Francesco Paresce, Simon Portegies Zwart. The stellar IMF of Galactic clusters and its evolution. arXiv:astro-ph/0409601

Edit again:

For the Milky Way, this table shows how large fractions of the main sequence stellar population the different spectral types make up (found in this question).

  • 1
    $\begingroup$ In your third paragraph, are you referring to the initial mass function? I'll insert the link if you want. $\endgroup$
    – Pulsar
    Jun 4, 2013 at 15:21
  • $\begingroup$ I was indeed, I had written it and apparently deleted tit again by mistake - thank you! $\endgroup$
    – Thriveth
    Jun 4, 2013 at 15:22
  • 2
    $\begingroup$ By the way, I think it is a bit funny how the Tamm et al. paper is written by authors Tamm, Tempel, Tenjes, Tihhonova and Tuvikene from institutions in Tartu and Tallinn :-D $\endgroup$
    – Thriveth
    Jun 4, 2013 at 16:19
  • $\begingroup$ How significant are the non main sequence stars likely to be? (this is an awesome answer by the way +1) $\endgroup$
    – jk.
    Jun 5, 2013 at 11:37
  • 1
    $\begingroup$ Agree great answer +1. The non-main sequence stars will be quite important, especially in a younger/star forming galaxy. A lot of the massive, hot, short lived stars are non-main sequence. If you're just interested in the combined colours of stellar populations, www-astro.physics.ox.ac.uk/~maraston/… gives some easy to use tables with the colours of populations of different ages given some choices of IMF, metallicity and stellar evolution models. Doesn't help if you want the colours of individual stars, but you could represent groups of stars... $\endgroup$
    – Kyle Oman
    Jun 5, 2013 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.