matplotlib / matplotlib/basemap

Polar Projection PDF Issue

オープン
#256 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
817
フォーク
395
PR マージ指標
30日以内にマージされた PR はありません

説明

Python 3.4
Conda 3.18.3
Matplotlib 1.5.1
basemap 1.0.7
Adobe Reader XI

Trying to plot a polar projection with a custom shapefile results in an error when opening the PDF in Adobe Reader.

I am creating two orthographic projections (a southern and northern hemisphere).

```
basemaps.append(Basemap(projection='ortho', lon_0=270, lat_0=90., resolution='c', ax=axes[0]))
basemaps.append(Basemap(projection='ortho', lon_0=90, lat_0=-90., resolution='c', ax=axes[1]))
```

I then draw a full world shapefile on each projection:

```
basemap.readshapefile('Earth', 'globe')
...
plt.savefig('amaps.pdf')
```

Everything works fine here and both basemaps display with the proper lines and shapes drawn. However, when downloading the PDF and displaying it in Adobe Acrobat, you will get something like this:
[amap.pdf](https://github.com/matplotlib/matplotlib/files/99791/amap.pdf) (which looks fine if you view it in your browser, but try downloading it and opening it with Adobe Reader). We've determined that the problem arises when the coastline includes lon, lat pairs in the opposite hemisphere from the hemisphere that it is to be drawn in. So if you are drawing the southern hemisphere, you cannot read a shapefile that has lon, lat points in the norther hemisphere, and vise-versa.

Our workaround required creating two separate shapefiles, one for the northern hemisphere and one for the southern. So now it looks like this:

```
# drawing northern hemisphere
if polar and idx == 0:
basemap.readshapefile('Earth_north', 'nh')
elif polar and idx == 1:
# drawing southern hemisphere
basemap.readshapefile('Earth_south', 'sh')
# drawing all other projections
else:
basemap.readshapefile('Earth', 'globe')
```

This works fine but shouldn't be necessary.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供された正射図法のスニペットとPDFを使用して、Basemap.readshapefileとplt.savefigで問題を再現します。半球をまたぐジオメトリについて、shapefileの処理とPDFの出力パスを調査します。PDFをAdobe Readerで開いたときに、全世界のshapefileが両方の半球で正しくレンダリングされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
matplotlib, python
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。