When I was shown the charts and the diagrams, to add, divide, and measure them; (line 3)
All those charts and figures are like toys compared to the reality that they are supposed to represent: in this case, the stars. To emphasize this point, Whitman doesn't use the word "stars" throughout the first half of the poem, even though we know that's what the astronomer must be lecturing on.
ranged in columns (line 2)
The astronomer tries to organize the outside world within set boundaries. You still wouldn't know by this point that the poem has anything to do with nature.
When I, sitting, (line 4)
Everything in the first half of the poem is meant to contrast with the second half. Whitman the poet loved to walk, and he loved the open road. He wasn't a sitter, no sir. So obviously this situation can't last very long.
In the mystical moist night-air (line 7)
Whitman paints a vivid scene using only a few words. This is the kind of phrase you might find in a novel by Beat writers like Jack Kerouac and Allen Ginsberg (no coincidence, considering how much they were influenced by Whitman). The speaker no longer feels alienated from nature, as he did inside the lecture room.
Look'd up in perfect silence at the stars. (line 8)
The poem moves from the abstract, scholarly term "astronomer" in the title and the first line to the simple and concrete word "stars." "Astro-," of course, refers to stars. In the same way, the speaker discovers the superiority of a simple, direct relationship to nature.