<jupyter_start><jupyter_text>Visualizing Satellite Imagery with Matplotlib Taking a closer look at satellite data with PythonIn the [Inspecting Satellite Imagery Notebook](Inspecting Satellite Imagery.ipynb), we learned how to use [Rasterio](https://rasterio.readthedocs.io/en/stable/) to read and manipulate satellite data. There we also learned that, since satellite images are really grids of pixel-values, a satellite image can be interpreted as a multidimensional array of values.You may already be familiar with the Python library [matplotlib](https://matplotlib.org/): here, we're going to briefly use that toolset to visually plot satellite data that has been read into a numpy array using Rasterio.<jupyter_code>import rasterio
from matplotlib import pyplot as plt

# This notebook explores a single 4 band (blue, green, red, NIR) PlanetScope scene in a UTM projection.
image_file = "example.tif"

# Use Rasterio to open the image.
satdat = rasterio.open(image_file)
# Load the 4 bands into 2d arrays - recall that we previously learned PlanetScope band order is BGRN.
b, g, r, n = satdat.read()
# Use imshow to load the blue band.
fig = plt.imshow(b)

# Display the results.
plt.show()
# Plot the green band using a non-default color ramp.
# https://matplotlib.org/users/colormaps.html
fig = plt.imshow(g)
fig.set_cmap('gist_earth')

# Display the results.
plt.show()
# Plot the red band and add a color bar.

fig = plt.imshow(r)
fig.set_cmap('inferno')
plt.colorbar()

# Display the results.
plt.show()
# Finally, plot the NIR band.
fig = plt.imshow(n)
fig.set_cmap('winter')
plt.colorbar()

# Since the axis labels are useless here, let's turn them off.
plt.axis('off')

# Display the results.
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08991981672394044, 'fraction_numerical': 0.001718213058419244, 'mean_word_length': 4.823333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '95200', 'license': 'Apache-2.0', 'n_tokens_mistral': 568, 'n_tokens_neox': 543, 'n_words': 218, 'path': 'jupyter-notebooks/getting-to-know-sat-imagery/Visualizing_Satellite_Imagery.ipynb', 'repo_name': 'hessandrea/notebooks', 'size': '1746'}