Ridgeline Plots (formerly Joyplots) is a kind of modern data visualization, whose name was coined by Jenny Bryan in 2017 and refers to the seminal debut album “Unknown Pleasures” released in 1979 on Factory Records by Joy Division, from Salford, England. Ridgeline Plots is generated from a series of ridgelines or joyplots, each of which consists of a series of histograms, density plots or time series for a number of data segments, all aligned to the same horizontal scale and presented with a slight overlap.
Ridgeline Plots, just like profiles or transects, could be used to show change in slope by illustrating the changes in height along a line drawn on a map (e.g., a DEM map). Elevation profiles are a side-view of the changes in elevation along the line as if the terrain has been sliced open and can be seen in aspect.
Following the idea, it is quite easy to create a *Ridgeline Plots of DEM* in Python. As we already know, generally DEM data could be load into a 2D array. Thus we can draw a ridgeline for each row and pack all ridgelines together to create a Ridgeline Plots of DEM. Such a method is quite straightforward and easy to implement. However, when the DEM data comes with many many rows, it will become very hard to identify each ridgeline and the resultant map will look just like a normal map. Therefore, it is necessary to add blank space between ridgelines or downsample data.
In this notebook, we will not do it manually step by step. We will use the package of ridge map to show a simple example. The package also provides a few excellent examples. If you are really interested in this kind of visualization, have a look. Moreover, ridge map uses *SRTM.py* internally to allows you to setup bounding boxes and coordinates to download DEM data from NASA's Shuttle Radar Topography Mission (SRTM).
from ridge_map import RidgeMap
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
Setup spatial bounds around New Zealand
rm = RidgeMap((165.058594,-47.635784,179.648438,-34.307144))
values = rm.get_elevation_data(num_lines=150)
values = rm.preprocess(values=values,
lake_flatness=2,
water_ntile=10,
vertical_ratio=240)
rm.plot_map(values=values,
label='New Zealand',
label_y=0.1,
label_x=0.55,
label_size=40,
linewidth=1,
line_color = plt.get_cmap('terrain'),
kind='elevation'
)
<matplotlib.axes._subplots.AxesSubplot at 0x1e59f8d0240>
Joel Lawhead (2019). Learning Geospatial Analysis with Python - Third Edition.
Travis E, Oliphant. A guide to NumPy, USA: Trelgol Publishing, (2006).
Stéfan van der Walt, S. Chris Colbert and Gaël Varoquaux. The NumPy Array: A Structure for Efficient Numerical Computation, Computing in Science & Engineering, 13, 22-30 (2011), DOI:10.1109/MCSE.2011.37
Fernando Pérez and Brian E. Granger. IPython: A System for Interactive Scientific Computing, Computing in Science & Engineering, 9, 21-29 (2007), DOI:10.1109/MCSE.2007.53
John D. Hunter. Matplotlib: A 2D Graphics Environment, Computing in Science & Engineering, 9, 90-95 (2007), DOI:10.1109/MCSE.2007.55
https://rasterio.readthedocs.io/en/stable/
http://xarray.pydata.org/en/stable/
https://github.com/ColCarroll/ridge_map
https://gist.github.com/ColCarroll/68e29c92b766418b0a4497b4eb2ecba4
http://www.acgeospatial.co.uk/ridge-map-plots-using-python/
https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/joy-plots-in-arcgis-pro/