-
Notifications
You must be signed in to change notification settings - Fork 0
Fix figure generation on GMT 6.5+ #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5b22f89
da31374
90b7d26
a9369dd
be05ba7
90a44bb
0610015
3bef088
37306d4
dce1754
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,7 @@ def gen_region_fig( | |
| # Merge with default | ||
| plot_kwargs = copy.deepcopy(DEFAULT_PLT_KWARGS) | (plot_kwargs or {}) | ||
|
|
||
|
|
||
| if title: | ||
| plot_kwargs["frame_args"] = plot_kwargs.get("frame_args", []) + [ | ||
| f"+t{title}".replace(" ", r"\040") | ||
|
|
@@ -300,31 +301,21 @@ def gen_region_fig( | |
| f"+s{subtitle}".replace(" ", r"\040") | ||
| ] | ||
|
|
||
| config_options = {'COLOR_NAN': plot_kwargs['water_color']} | (config_options or {}) | ||
| pygmt.config(**config_options) | ||
|
||
|
|
||
| if fig is None: | ||
| fig = pygmt.Figure() | ||
|
|
||
| if config_options: | ||
| pygmt.config(**config_options) | ||
|
|
||
| water_color = plot_kwargs['water_color'] | ||
| plot_kwargs['frame_args'] = plot_kwargs.get('frame_args', []) + [f'+g{water_color}'] | ||
| fig.basemap( | ||
| region=region if region else "NZ", | ||
| projection=projection, | ||
| frame=plot_kwargs["frame_args"], | ||
| ) | ||
|
|
||
| # Plot coastline and background water | ||
| bg_region = region if region else fig.region | ||
| water_bg = geopandas.GeoSeries( | ||
| geometry.LineString( | ||
| [ | ||
| (bg_region[0], bg_region[2]), | ||
| (bg_region[1], bg_region[2]), | ||
| (bg_region[1], bg_region[3]), | ||
| [bg_region[0], bg_region[3]], | ||
| ] | ||
| ) | ||
| ) | ||
| fig.plot(water_bg, fill=plot_kwargs["water_color"], straight_line=True) | ||
| # Plot coastline | ||
| fig.plot( | ||
| data=map_data.coastline_df, | ||
| pen=f"{plot_kwargs['coastline_pen_width']}p,{plot_kwargs['coastline_pen_color']}", | ||
|
|
@@ -379,14 +370,14 @@ def gen_region_fig( | |
| continuous=plot_kwargs["topo_cmap_continous"], | ||
| cmap=plot_kwargs["topo_cmap"], | ||
| reverse=plot_kwargs["topo_cmap_reverse"], | ||
| no_bg=True | ||
lispandfound marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| # Plot topography | ||
| fig.grdimage( | ||
| grid=topo_grid, | ||
| shading=topo_shading_grid, | ||
| cmap=True, | ||
| nan_transparent=True, | ||
| ) | ||
|
|
||
| # Plot inland water | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.