  We study the distribution of singularities (poles and zeros) of rational
solutions of the Painlev\'e IV equation by means of the isomonodromic
deformation method. Singularities are expressed in terms of the roots of
generalised Hermite $H_{m,n}$ and generalised Okamoto $Q_{m,n}$ polynomials. We
show that roots of generalised Hermite and Okamoto polynomials are described by
an inverse monodromy problem for an anharmonic oscillator of degree two. As a
consequence they turn out to be classified by the monodromy representation of a
class of meromorphic functions with a finite number of singularities introduced
by Nevanlinna. We compute the asymptotic distribution of roots of the
generalised Hermite polynomials in the asymptotic regime when $m$ is large and
$n$ fixed.
