matplotlib / matplotlib/basemap

Polar Projection PDF Issue

Ouverte
#256 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
817
Forks
395
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le problème avec Basemap.readshapefile et plt.savefig à l’aide des extraits fournis concernant la projection orthographique et du PDF. Examinez la gestion du shapefile et le chemin de sortie du PDF pour les géométries traversant des hémisphères. Le travail est considéré comme terminé lorsqu’un shapefile couvrant le monde entier se rend correctement dans les deux hémisphères à l’ouverture du PDF dans Adobe Reader.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
matplotlib, python
Domaine
data-visualization
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.