matplotlib / matplotlib/basemap

plotparallels()/plotmeridians() only support xoffset or yoffset not both and do not support horizontalalignment or verticalalignment

Open
#325 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

plotparallels() and plotmeridians() only support xoffset or yoffset not both.

plotparallels() and plotmeridians() do not support horizontalalignment or verticalalignment via kwargs as these are hard coded within Basemap.

I found both of these because I wanted the labels inside the map border with the parallels above the line at the right of the plot and the meridians to the right of the line at the bottom of the plot. I found a hack by altering the returned matplotlib objects:

meridians = bmap.drawmeridians(meridians,labels=[0,0,1,0],fontsize=10,
                               color='gray', yoffset=-abs(right-left)
for k, v in meridians.iteritems():
    v[1][0].set_horizontalalignment('left')

This sets the label to the top but then moving them the size of the plot then setting horizontal alignment via returned matplotlib object.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the implementations of plotparallels() and plotmeridians() and trace how xoffset, yoffset, and kwargs are handled. Verify the behavior with labels on both sides of the map: both offsets should work together, and horizontalalignment and verticalalignment should be accepted. Done means callers no longer need to modify the returned matplotlib objects for this positioning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.