Allow export of panel size
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization
Research direction
Start by reading the existing fig.shift_origin() behavior and the Session calls that expose plot dimensions in inches. Trace how Figure methods access the current panel size, then define the panel_dimensions('c') behavior shown in the example. Done means callers can retrieve the current panel width and height in the requested units and use the height for a later projection.
Written by the indexing model from the issue text.
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
- Dominant language
- Python
- Stars
- 882
- Forks
- 261
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenericMappingTools/pygmt
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
GenericMappingTools/pygmt#5014 · 1 comment ·
Maintainers usually reply within 1 day
-
discussions documentation
Difficulty 1/5 Under an hour Newbie friendliness 78/100
GenericMappingTools/pygmt#4992 ·
Maintainers usually reply within 1 day
-
Improve reporting the GMT version via "pygmt.show_versions()"Possibly taken @yvonnefroehlich claimed this 114 days ago. Openmaintenance
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GenericMappingTools/pygmt#4812 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
GenericMappingTools/pygmt#4765 ·
Maintainers usually reply within 1 day
-
Add an AGENTS.md filePossibly taken A pull request linked to this issue is open or already merged. Opendiscussions
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GenericMappingTools/pygmt#4677 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GenericMappingTools/pygmt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TigreGotico/orthography2ipa#2950 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Unstructured-IO/unstructured#4876 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openfoodfacts/openfoodfacts-python#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
fairagro/m4.2_sql_to_arc#388 ·
Maintainers usually reply within 1 day