GenericMappingTools / GenericMappingTools/pygmt

Automatic labels and titles to plots based on xarray metadata

Open
#1,412 1 comment 2 reactions 0 assignees View on GitHub
feature request help wanted
Dominant language
Python
Stars
874
Forks
255
Avg merge
1d 21h
Merged PRs (30d)
40

Description

**Description of the desired feature**

Originally posted by @leouieda as a comment about `xarray` integration at https://hackmd.io/@pygmt/SkVmX_20d:

> Any thoughts on better integration with xarray? Dataset objects can have rich metadata (coordinate names, units, projections, etc) that could be leveraged to automatically add labels and titles to plots. Their plotting backend does that with matplotlib and it's very convenient.

My interpretation of this 'feature request' is that `grdimage` could automatically add x-axis and y-axis labels/annotations to the plot, and include a title about the z-variable name (without the user setting it explicitly). Something based on https://github.com/pydata/xarray/pull/519.

![xarray automatic labels and titles](https://cloud.githubusercontent.com/assets/5356122/9125954/6c30206a-3c5b-11e5-8fd7-98c7ecd2ef0e.png)

The auto-labels/titles currently comes for free in `xarray` through the [`xarray.DataArray.plot.imshow()`](http://xarray.pydata.org/en/v0.19.0/generated/xarray.DataArray.plot.imshow.html) function. We could inspect the source code at https://github.com/pydata/xarray/blob/v0.19.0/xarray/plot/plot.py#L244 to see how this can be implemented in PyGMT.

**Are you willing to help implement and maintain this feature?** Long term stuff for PyGMT > v0.6.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.