Analogy between rotation and density for Dirac fermions in a magnetic field