diff --git a/README.md b/README.md index 89582da..72e6ce2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Install this application: - `miniconda`: https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html - If you already have miniconda or anaconda installed (`conda` is a command in your terminal), skip this step. -Download this repository by heading over to the [latest release](https://github.com/johnisom/wildfire-analyzer/releases/tag/v0.3) and downloading the source code. Unzip it. +Download this repository by heading over to the [latest release](https://github.com/johnisom/wildfire-analyzer/releases/tag/v0.4) and downloading the source code. Unzip it. Then, open your terminal and navigate to the unzipped repository. In a terminal with miniconda active (`conda` is a useable command), install python package dependencies: ```sh diff --git a/src/plotting.py b/src/plotting.py index 990687a..fc02c4c 100644 --- a/src/plotting.py +++ b/src/plotting.py @@ -11,8 +11,10 @@ def plot_counties_by_number_of_fires(counties_geo_df, keys, plot_title): zero_fire_counts = counties_geo_df[counties_geo_df.fire_count == 0] more_than_zero_fire_counts = counties_geo_df[counties_geo_df.fire_count > 0] fig, ax = plt.subplots(figsize=[12, 8]) - zero_fire_counts.plot(ax=ax, color='grey', legend=True, aspect=1) - more_than_zero_fire_counts.plot(ax=ax, column='fire_count', legend=True, norm=LogNorm(vmin=more_than_zero_fire_counts.fire_count.min(), vmax=more_than_zero_fire_counts.fire_count.max())) + if len(zero_fire_counts) > 0: + zero_fire_counts.plot(ax=ax, color='grey', legend=True) + if len(more_than_zero_fire_counts) > 0: + more_than_zero_fire_counts.plot(ax=ax, column='fire_count', legend=True, norm=LogNorm(vmin=more_than_zero_fire_counts.fire_count.min(), vmax=more_than_zero_fire_counts.fire_count.max())) ax.tick_params(axis='both', which='both', bottom=False, left=False, labelbottom=False, labelleft=False) ax.set_title(plot_title) fig.supxlabel('(Gray: data not available)') @@ -25,8 +27,10 @@ def plot_counties_by_total_area_burned(counties_geo_df, keys, plot_title): zero_acres_burned = counties_geo_df[counties_geo_df.acres_burned == 0] more_than_zero_acres_burned = counties_geo_df[counties_geo_df.acres_burned > 0] fig, ax = plt.subplots(figsize=[12, 8]) - zero_acres_burned.plot(ax=ax, color='grey', legend=True, aspect=1) - more_than_zero_acres_burned.plot(ax=ax, column='acres_burned', legend=True, norm=LogNorm(vmin=more_than_zero_acres_burned.acres_burned.min(), vmax=more_than_zero_acres_burned.acres_burned.max())) + if len(zero_acres_burned) > 0: + zero_acres_burned.plot(ax=ax, color='grey', legend=True) + if len(more_than_zero_acres_burned) > 0: + more_than_zero_acres_burned.plot(ax=ax, column='acres_burned', legend=True, norm=LogNorm(vmin=more_than_zero_acres_burned.acres_burned.min(), vmax=more_than_zero_acres_burned.acres_burned.max())) ax.tick_params(axis='both', which='both', bottom=False, left=False, labelbottom=False, labelleft=False) ax.set_title(plot_title) fig.supxlabel('(Gray: data not available)')