Chromagrams are similar to spectrograms in that they are representations of variations in frequency of an audio signal over time. Chromagrams differ, however, in that they concern themselves not with the absolute frequency of a signal but rather with its chroma: its perceived pitch.
Chroma/pitch is a circular percept. That is, if you start a tone at middle C (~262 hz) and gradually increase it in frequency, when the frequency is doubled to ~524 hz you will arrive at a note that sounds higher than middle C but somehow “the same”, so this note is also called a ‘C’. It’s this perceived quality of sameness in frequencies differing by a factor of 2 that creates the phenomenon of the octave, and makes possible the vast majority of conventional ‘Western’ music structure. [See this Wikipedia page for a better explanation.]
Because of this circularity in pitch, we can abstract away and put all possible frequencies into a finite number of ‘bins’ (pitch classes), where frequencies in the same bin are those that sound ‘the same’. The way this is conventionally done is to classify all frequencies into the 12 notes A, A#, B, C, …, G, G#.
What a chromagram does is just keep track of which of these bins the sound in an audio signal belongs to as time progresses. This has many uses, including distributional key-finding (which is what I’m currently using them for.)
As an example, below is the chromagram for ‘Rich Girl’ by Hall & Oates, generated using librosa.
The song is in the key of F major, and if you kind of squint you can see that the majority of the strength of the signals over time belong to the notes F, G, A, Bb, C, and D, which aligns with this key.
Another more clear example is the chromagram below for another less noisy piece in D minor:
In this one you can clearly see the majority of notes belonging to the categories D, F, A, and C, which again aligns with the piece’s key.