- Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
feature requestNew feature wantedNew feature wanted
Description
If the projections that you are using are not initially defined by a given height and width, then it is difficult to extract the dimensions of the plot in cm. This is an issue, for example, if panel A is an oblique mercator projection (with a projection defined by a central point and a rotation, and a region given as a top left and bottom right coordinate) and you would like panel B to be the same height (where the projection is f'X{width}c/{height}c').
As fig.shift_origin() has included an option to get the plot size in inches since v15.0.0 :
with Session() as lib: lib.call_module(module="plot", args=build_arg_list(kwdict)) _xshift = lib.get_common("X") # False or xshift in inches _yshift = lib.get_common("Y") # False or yshift in inches it feels like it should be possible to include a function where _xshift and _yshift can be exported as variables.
Example use:
proj = f"Oa{center_lon}/{center_lat}/55/{width}c+v" ##### PANEL HEIGHT IN CM NOT DEFINED region = f"{tl_lon}/{tl_lat}/{br_lon}/{br_lat}+r" fig = pygmt.Figure() fig.coast(region=region, projection=proj, land="gray80", water="steelblue", area_thresh=1000) panelA_width, panelA_height = fig.panel_dimensions('c') ##### RETURN PANEL SIZE IN CM fig.shift_origin(width='w') fig.basemap(region=[0, xmax, 0, ymax], projection=f'X{panelb_width}c/{panelA_height}c', frame=['WSne', 'xafg2', 'yafg1.0']) ##### ENSURE HEIGHT OF NEW PANEL MATCHES PANEL A Are you willing to help implement and maintain this feature? Yes
Metadata
Metadata
Assignees
Labels
feature requestNew feature wantedNew feature wanted