@@ -47,8 +47,21 @@ def add_waypoint_markers(ax, distances, offset=15, marker_size=70):
4747 )
4848
4949
50+ def add_title (ax , title , fontsize = 13 , y0 = 1.03 ):
51+ """Add title."""
52+ ax .text (
53+ 0 ,
54+ y0 ,
55+ title ,
56+ ha = "left" ,
57+ va = "bottom" ,
58+ transform = ax .transAxes ,
59+ fontsize = fontsize ,
60+ )
61+
62+
5063# fig
51- fig = plt .figure (figsize = (12 , 13 ), dpi = 300 )
64+ fig = plt .figure (figsize = (9 , 13 ), dpi = 300 )
5265
5366# custom layout
5467gs = gridspec .GridSpec (3 , 2 , height_ratios = [1.5 , 1 , 1 ])
@@ -59,20 +72,20 @@ def add_waypoint_markers(ax, distances, offset=15, marker_size=70):
5972ax4 = fig .add_subplot (gs [2 , 1 ])
6073
6174# overview image
62- ax0 . set_title ( r"$\bf{a}$" + ") MFP expedition overview" , loc = "left" )
75+ add_title ( ax0 , r"$\bf{a}$" + ") MFP expedition overview" , y0 = 1.01 )
6376img = mpimg .imread (f"{ SAMPLE_DIR } expedition_overview.png" )
6477ax0 .imshow (img )
6578ax0 .axis ("off" )
6679
6780# adcp
68- ax1 . set_title ( r"$\bf{b}$" + ") ADCP (flow speed)" , loc = "left " )
81+ add_title ( ax1 , r"$\bf{b}$" + ") ADCP (flow speed)" )
6982ax1 .set_ylabel ("Depth (m)" )
7083ax1 .set_xlabel ("Distance (km)" )
7184plot_adcp (adcp_ds , ax1 )
7285add_waypoint_markers (ax1 , waypoint_distances )
7386
7487# drifters
75- ax2 . set_title ( r"$\bf{c}$" + ") Surface drifters" , loc = "left " )
88+ add_title ( ax2 , r"$\bf{c}$" + ") Surface drifters" )
7689plot_drifters (
7790 drifter_ds ,
7891 ax2 ,
@@ -81,7 +94,7 @@ def add_waypoint_markers(ax, distances, offset=15, marker_size=70):
8194)
8295
8396# CTD (temperature)
84- ax3 . set_title ( r"$\bf{d}$" + ") CTD (temperature)" , loc = "left " )
97+ add_title ( ax3 , r"$\bf{d}$" + ") CTD (temperature)" )
8598ax3 .set_ylabel ("Depth (m)" )
8699ax3 .set_xlabel ("Distance (km)" )
87100_ , _distances_regular , _var_masked = plot_ctd (
@@ -96,7 +109,7 @@ def add_waypoint_markers(ax, distances, offset=15, marker_size=70):
96109add_waypoint_markers (ax3 , ctd_wp_distances , offset = 45 , marker_size = 60 )
97110
98111# CTD (oxygen)
99- ax4 . set_title ( r"$\bf{e}$" + ") CTD (oxygen)" , loc = "left " )
112+ add_title ( ax4 , r"$\bf{e}$" + ") CTD (oxygen)" )
100113ax4 .set_xlabel ("Distance (km)" )
101114plot_ctd (
102115 ctd_bgc_ds , ax4 , plot_variable = "oxygen" , vmin = 0 , vmax = ctd_bgc_ds .o2 .max ()
@@ -107,6 +120,6 @@ def add_waypoint_markers(ax, distances, offset=15, marker_size=70):
107120plt .tight_layout ()
108121plt .show ()
109122
110- fig .savefig ("figure1.png" , dpi = 300 )
123+ fig .savefig ("figure1.png" , dpi = 300 , bbox_inches = "tight" )
111124
112125# %%
0 commit comments