From d50cdb49095773cdeba8cb82c659480e0b1d788e Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Tue, 24 Jul 2018 15:29:45 +1000 Subject: [PATCH] Plot figures with fixed dimensions by default --- las_outputs.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/las_outputs.py b/las_outputs.py index 88b6a01..f53217e 100644 --- a/las_outputs.py +++ b/las_outputs.py @@ -56,7 +56,7 @@ def remove_temp_files(directory): return None -def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, survey_date): +def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, survey_date, scale_figures=False): csv_name = profile_name + '.csv' profiles = pd.read_csv(os.path.join(csv_output_dir, csv_name)) @@ -79,7 +79,12 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, fig_h = profiles.dropna().values.max() / m_per_inch * vertical_exag fig_w = (profiles.index.max() - ch_min) / m_per_inch - fig, ax = plt.subplots(figsize=(fig_w, fig_h)) + if scale_figures: + fig, ax = plt.subplots(figsize=(fig_w, fig_h)) + ax.set_aspect(vertical_exag) + else: + fig, ax = plt.subplots(figsize=(10, 6)) + for col in profiles.columns: profile = profiles.loc[ch_min:, col] date_str = col.split('_')[-1] @@ -87,7 +92,6 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, ax.plot(profile.index, profile, label=date) - ax.set_aspect(vertical_exag) ax.set_xlabel('Chainage (m)', labelpad=10) ax.set_ylabel('Elevation (m AHD)', labelpad=10)