title | layout | include_vega |
---|---|---|
Lecture 10 |
lecture |
true |
- What is the visualization trying to show?
- What are its methods?
- What are the strengths / weaknesses?
- Choosing an Engine
- More
bqplot
- Markdown
- Maps
- Projections
- Coordinate Systems
- Plotting with CartoPy
- Assignment
- Idyll
The Earth is a sphere.
(Fun question: to what degree is it a sphere?)
Have you ever wrapped a piece of paper around a ball?
To map from one system to another, we must "project" from the original sphere to the flat object we are observing.
What are some things we could preserve during such a projection?
Typically, one or more of these will be preserved, or at least, the distortion will be minimized:
- Area
- Shape (Conformal)
- Distance
There are other properties that can be preserved, as well. Typically, maps will be a "compromise" between preserving different properties.
What happens when we preserve one property over another?
Mercator is a "conformal" projection. What is wrong with this?
We can characterize distortions in a projection by examining how a known shape appears on them. The Tissot Ellipse of Distortion is a method of showing this by drawing circles of a fixed radius and examining their elliptical distortion.
What do you notice?
What happens when we make a map that minimizes one region and maximizes another?
Once we have our system of transformation, we need to have a method of representing positions.
Three common baseline methods:
- Spherical coordinates
- Latitude and Longitude
- Degrees, minutes, seconds
Take care with:
- Zero points
- North/South, East/West
- Ranges
CartoPy is a toolkit that builds on matplotlib to create fast, easy map representations.
We will be relying on three key concepts:
- Axes projections (similar to our polar projections)
- Coordinate representations
- Shapes
Using these, we will be able to build out many visualizations.
We start out by constructing an axes in CartoPy that uses a given projection:
import cartopy
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection=cartopy.crs.Mollweide())
ax.coastlines()
What does this do?
Transforming from a spherical reference system to a flat reference system is the job of the projection; transforming from one discretization of a sphere to another is the job of the coordinate system.
We can utilize Coordinate Reference Systems to describe the input coordinate system and the rasterization system are described.
For example, there are several different ways to draw "straight" lines. We can
do both PlateCarree
and Geodetic
.
c_lat, c_lon = 40.1164, -88.2434
a_lat, a_lon = -18.8792, 47.5079
fig = plt.figure()
ax = fig.add_subplot(111, projection = cartopy.crs.PlateCarree())
ax.gridlines()
ax.coastlines()
ax.set_global()
ax.plot([c_lon, a_lon], [c_lat, a_lat], transform = cartopy.crs.PlateCarree())
ax.plot([c_lon, a_lon], [c_lat, a_lat], transform = cartopy.crs.Geodetic())
Let's now set up CartoPy to plot some of the data we saw last week, in the transportable array.
- Google Maps & Earth
- WorldWide Telescope
- CesiumJS
Your assignment is posted in the nbgrader
instance. You have a week and a
half, but it's easy.
Idyll is a reactive markup language for visualization and narrative documents.
We will create a name explorer.