Frequency resolution
Frequency resolution of your spectrogram is connected to time window length and sampling frequency by following relation:

$$\Delta f = \dfrac{f_s}{N}$$

where $f_s$ is the sampling frequency, and $N$ is length of your time window in samples. $N$ can be easily expressed in seconds, in your case length of window is $T=0.5 \mathtt{s} $ and $f_s = 1000 \mathtt{Hz} $. Therefore window length in samples is: $$N=T\cdot f_s = 0.5 \cdot 1000=500$$
Which is giving you frequency resolution to be:

$$\Delta f = \dfrac{1000}{500}= 2 \mathtt{Hz}$$

You might also notice that substitution of $N$ with respect to $T$ and $f_s$ yields:

$$\Delta f = \dfrac{f_s}{T\cdot f_s}= \dfrac{1}{T} $$

where $T$ is obviously length of your window.