I have plotted all m2, M7, M2, m7, m3, M6, M3, m6, aug4, dim5 intervals in all key signatures, and it seems that the notes don't move vertically or change accidentals (barring for accidentals in the key signature) if you go to a flattened/sharpened variant of the key signature such as (Cb, C, C#), (Eb, E), (Gb, G), (Bb, B), (Db, D), (F, F#), (Ab, A) (i.e., using the key signature's name as root note). Is this correct or did I mess up when transposing?
NOTE: This answer is given in terms of major keys, but the same holds true for (natural) minor. It also is only true for notes within the given key; it does not hold true for chromatic pitches outside the given key.
This is correct. As long as the letter-name (and mode) of the key doesn't change, the key signature change is no different than transposing every single note in the key up or down a half step.
When moving from X to X♭, the lines and spaces of the scale stay exactly the same, but with each pitch lowered a half step.
When moving from X to X♯, then lines and spaces again stay exactly the same, but with each pitch raised a half step.
Since every line/space is transposed by exactly the same amount, the intervals between each line/space stay the same.
However, when the letter name of the key changes, the intervals between lines and spaces (can) change. The B line and C space are always a half-step apart in all of the "keys of C" (C♭, C♮, C♯) or G, but they're a whole step apart in the key(s) of D, E, F, A, and B.
This is almost correct, but accidentals not in the key signature will burn you. The most common example of those are leading tones of minor keys. For example, when transposing music from F minor to F sharp minor, you need to transpose all E naturals in the F minor version to E sharps in the F sharp minor version.
Chromatic scales and/or portions thereof may need to be handled deftly when transposed. A B♭-B-C-C♯-D passage in E flat major will naively get transposed to B-B♯-C♯-C double sharp-D♯ when transposing to E major, while B-C-C♯-D-D♯ may be a lot more readable and stick to other conventions depending on where you put the barlines.
I have plotted all m2, M7, M2, m7, m3, M6, M3, m6, aug4, dim5 intervals in all key signatures, and it seems that the notes don't move vertically or change accidentals...
When you word it specifically as "don't...change accidental" then, yes, your point is true of all the diatonic intervals in any key.
But you might be overlooking an important point. If you don't think literally of accidentals, but think in terms of "alteration applied" as raised or lowered tones, the idea applies to chromatic intervals as well. Consider an augmented fourth (
A4) that involves a chromatic tone, like an
A4 built on the second major scale degree, solfege
The lines and spaces don't change.
And while the specific accidentals change, the alterations applied do not. The diatonic fourth above the second scale degree in major is always a perfect fourth. To augment it we always raise the upper tone. Whether a
♮ is used to signify raising the tone is just a matter of the key signature is sharps or flats.
I think the reason this matters, that it's worth pointing out, is because the reading approach is to look for tones raised/lowered from their diatonic position and applying some general principles about intervals. For example, any time you see a third, and there is some kind of accidental to raise it, you are probably dealing with a "bigger" third, a major third...
I think the reading strategy is something like, for example with
C# major, don't read each and every letter and sharp/flat, but first get anchored on the diatonic
A#) and then, rather than thinking literally
C double-sharp, just play a
And the deeper insight is that this kind of chromatically raised major third will probably be functioning as a secondary dominant. That raised tone above the
LA is actually an alteration of the tonic, likely making it a temporary leading tone that will ascend to the next scale degree up, up to
You can have weirdness like this...
...where the raised tone actually forms an augmented third, but such a case is probably either very chromatic music, or just bad enharmonic notation. If the music is truly very chromatic then these kinds of rule-of-thumb strategies won't be of much help.