Introduction

At this link, one can find a graphic displaying conditions (including temperature, density, and pressure) at various altitudes, corresponding to different layers of the atmosphere.

This graphic is from the ACT standardized test.

https://magoosh.com/hs/uncategorized/2016/dealing-with-a-complicated-graph-in-act-science-part-3-connecting-the-graph-and-the-questions/

This graphic has a very high data-to-ink ratio. On the other hand, there are some aspects of this that are somewhat confusing.

For example, you would have to look carefully to see that two of the y-axes (pressure and density) are actually reversed (get larger as you go further down).

The lines ending in “pause” indicate the end of each layer, so for example the troposphere goes from the surface to the tropopause. But I had to Google this to confirm what was going on. With a bit of color (increases the “ink”, but I think it’s worth it), we can make it clear what the boundaries of each layer are.

Finally, we probably want to break up into two charts looking at temperature vs. altitude and pressure/density vs. altitude, since it seems this graphic is really focused on looking at how altitude affects the other variables.

With some changes, we can make a graphic that even a high schooler who didn’t do so well on the ACT can understand!

Libraries

Load libraries.

library(ggplot2)
library(gridExtra)

Create data table from the graphic.

Set up data table estimating points from the graph.

To keep things simple, we’ll ignore density and focus just on pressure. But plots including density would look similar to the ones for pressure, just with different numbers on the scale. Both have the same directional relationships to temperature and altitude, and are both on a log-like scale. If we had the full data available, we could easily add a second y-axis to show density along with pressure.

Pressure is not plotted on a true log scale, since 10 and 100 are not as far apart as 100 and 1,000. So it’s a bit hard to get the values, but we’ll do our best to estimate.

atmosphere <- data.frame(Altitude = c(0,18,52,82,120),
    Temperature = c(20,-30,10,-70,50),
    Pressure = c(1000,200,0.8,.08,.01))

layer_boundaries <- c(0,18,52,82)

Make plots.

Make plots for temperature (y) vs. altitude (x) and pressure (y) vs. altitude (x).

Add lines for where 1-2k angstrom and 2-3k angstrom radiation stop.

Note, this won’t have the nice curves of the original plot, since I don’t have the full data. But should show the same general concepts.

mycol <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") #From http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette.
mycol <- mycol[c(2:8,1)]

plot1 <- ggplot(atmosphere,
    aes(Altitude,Temperature)) +
    geom_line() +
    theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="none") +
    xlab("Altitude (km)") +
    ylab("Temperature (Celsius)") +
    geom_rect(aes(xmin = 0,xmax=18,ymin=-Inf,ymax=Inf),fill=mycol[1],alpha=0.1) +
    geom_rect(aes(xmin = 18,xmax = 52,ymin=-Inf,ymax=Inf),fill=mycol[2],alpha=0.1) +
    geom_rect(aes(xmin = 52,xmax = 82,ymin=-Inf,ymax=Inf),fill=mycol[3],alpha=0.1) +
    geom_rect(aes(xmin = 82,xmax = Inf,ymin=-Inf,ymax=Inf),fill=mycol[4],alpha=0.1) +
    geom_text(x=9,y=-50,label="troposphere",angle=90) +
    geom_text(x=median(c(18,52)),y=-50,label="stratosphere",angle=90) +
    geom_text(x=median(c(52,82)),y=-50,label="mesosphere",angle=90) +
    geom_text(x=median(c(82,125)),y=-50,label="thermosphere",angle=90) +
    coord_cartesian(ylim=c(-75,70)) +
    geom_segment(x = Inf,xend = 115,y = 65,yend = 65,arrow = arrow(length = unit(0.1,"inches"))) +
    geom_segment(x = Inf,xend = 45,y = 55,yend = 55,arrow = arrow(length = unit(0.1,"inches"))) +
    geom_text(x=110,y=68,label="1-2,000 A\nradiation") +
    geom_text(x=40,y=58,label="2-3,000 A\nradiation")

plot2 <- ggplot(atmosphere,
    aes(Altitude,Pressure)) +
    geom_line() +
    theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black")) +
    xlab("Altitude (km)") +
    ylab("Pressure (millibars)") +
    scale_y_log10()

grid.arrange(plot1,plot2,ncol=2)

We can now easily draw the following conclusions.

  1. Atmospheric pressure decreases exponentially as you get further and further from the surface.
  2. Temperature decreases as you go up from the surface through the troposphere, increases as you go up into the stratosphere, decreases as you go up into the mesosphere, and increases again as you go up into the thermosphere.
  3. One form of radiation (1-2,000 angstrom) only goes through part of the thermosphere, suggesting it is absorbed there. Same idea for 2-3,000 angstrom radiation and the stratosphere. This seems to explain the increase in temperature we see as we go up into these layers.