Ultracold neutrons (UCNs) can be bound by the potential of terrestrial gravity and a reflecting mirror. The wave function of the bound state has characteristic modulations. We carried out an experiment to observe the vertical distribution of the UCNs above such a mirror at Institut Laue-Langevin in 2011. The observed modulation is in good agreement with that prediction by quantum mechanics using the Wigner function. The spatial resolution of the detector system is estimated to be 0.7 micro meter. This is the first observation of gravitationally bound states of UCNs with submicron spatial resolution.