matplotcheck
matplotcheck copied to clipboard
Create Vignette - Documentation for multi axis figures
https://github.com/earthlab/autograding-notebooks/blob/master/notebooks/ea-homework-for-timeseries-raster.ipynb
# Plot the data - place your final data here
# BEGIN SOLUTION
# Add plot code only for plots 1 and 2 here
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10))
ep.plot_rgb(naip_2017_crop,
rgb=[0, 1, 2],
extent=naip_2015_ext,
title="Homework PLOT 1: NAIP 2017 Post Fire RGB Image\n Cropped",
ax=ax1)
fire_bound_utmz13.plot(ax=ax1, color='None',
edgecolor='white', linewidth=2)
# plot 2017 cropped data
ep.plot_rgb(naip_2017_crop,
rgb=[3, 0, 1],
extent=naip_2015_ext,
title="Homework PLOT 2: NAIP 2017 Post Fire CIR Image",
ax=ax2)
fire_bound_utmz13.plot(ax=ax2, color='None',
edgecolor='white', linewidth=2)
plt.show()
# END SOLUTION
### DO NOT REMOVE LINE BELOW ###
raster_plot = nb.convert_axes(plt, which_axes="all")
# Here i have to create a set of tests for a plot with subplots. this might involve loops
hw_raster_plot1 = ra.RasterTester(raster_plot[0])
hw_raster_plot2 = ra.RasterTester(raster_plot[1])
test_axis_off_plot1 = [hw_raster_plot1.assert_axis_off(),
1,
"RGB Image: Axis format looks great!",
"RGB Image: Looks like your axis is still on. Please turn axis_off."]
test_axis_off_plot2 = [hw_raster_plot2.assert_axis_off(),
1,
"CIR Image: Axis format looks great!",
"CIR Image: Looks like your axis is still on. Please turn axis_off."]
# Check plot extent ?? -- not sure i can do that yet with MPC functionality but it would be easy to add
# Check title
test_title_plot1 = [hw_raster_plot1.assert_title_contains(["NAIP", "2017", "RGB"]),
2,
"Title looks good",
"oops check your title"]
test_title_plot2 = [hw_raster_plot2.assert_title_contains(["NAIP", "2017", "CIR"]),
2,
"Title looks good",
"oops check your title"]
run_all_tests([test_axis_off_plot1,
test_axis_off_plot2,
test_title_plot1,
test_title_plot2])