Skip to content

fix for issue #88 #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 10, 2012
Merged

fix for issue #88 #89

merged 3 commits into from
Dec 10, 2012

Conversation

jswhit
Copy link

@jswhit jswhit commented Nov 25, 2012

previously, the contourf and contour methods masked all points outside the map projection region. This meant that if a grid cell was partly inside and partly outside the map projection region, nothing was drawn, leaving a gap along the edge of the map. This is particularly noticeable for very coarse resolution grids. This commit only masks those points more than one grid length beyond the edge of the map projection region.

This may have some unintended consequences, so it will need a fair bit of testing before being merged into master.

@jswhit jswhit mentioned this pull request Nov 25, 2012
@ajheaps
Copy link

ajheaps commented Nov 26, 2012

Hi Jeff,
many thanks - that looks much better in the zoomed area. The contours plot correctly now but are some stray contour labels outside the contour area as per the plot at http://climate.ncas.ac.uk/ajh/basemap/python2.png. I guess these come from the contour command.

I've tried doing a northern hemisphere polar stereographic plot using the same piece of code (which worked before the mod) and this now gives an error:
plt.clabel(cs, fmt = '%d', colors = 'k', fontsize=11)
File "/usr/local/src/epd/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2170, in clabel
ret = ax.clabel(CS, _args, *_kwargs)
File "/usr/local/src/epd/lib/python2.7/site-packages/matplotlib/axes.py", line 7326, in clabel
return CS.clabel(_args, *kwargs)
File "/usr/local/src/epd/lib/python2.7/site-packages/matplotlib/contour.py", line 209, in clabel
self.labels(inline,inline_spacing)
File "/usr/local/src/epd/lib/python2.7/site-packages/matplotlib/contour.py", line 579, in labels
inline_spacing )
File "/usr/local/src/epd/lib/python2.7/site-packages/matplotlib/contour.py", line 469, in calc_label_rot_and_inline
nlc.append( np.r
[ lc[:I[0]+1], xy1 ] )
UnboundLocalError: local variable 'xy1' referenced before assignment

Regards
Andy

@jswhit
Copy link
Author

jswhit commented Nov 26, 2012

I don't see those extraneous contour levels with matplotlib from github master - I suspect that's a matplotlib clabel bug that has been fixed.

Regarding the NH stereo issue, can you post that code?

@ajheaps
Copy link

ajheaps commented Nov 26, 2012

Hi Jeff,
I'll download the latest Matplotlib from github master and see if that fixes the extraneous labels. The NH stereo issue is intermittent and I suspect this is my coding problem rather than anything else.

  Regards
    Andy

jswhit pushed a commit that referenced this pull request Dec 10, 2012
@jswhit jswhit merged commit 91ce617 into matplotlib:master Dec 10, 2012
@ajheaps
Copy link

ajheaps commented Dec 13, 2012

Hi Jeff,
the extraneous labels looks to be a postscript problem in
matplotlib.
http://matplotlib.1069221.n5.nabble.com/Contour-produces-extraneous-labels-in-postscript-td39988.html
gives further details.

If I'm brave I might have a look at the postscript code in matplotlib in
the new year.

   Regards
     Andy

On 26/11/12 14:17, Jeff Whitaker wrote:

I don't see those extraneous contour levels with matplotlib from
github master - I suspect that's a matplotlib clabel bug that has been
fixed.

Regarding the NH stereo issue, can you post that code?


Reply to this email directly or view it on GitHub
#89 (comment).

Andy Heaps
National Centre for Atmospheric Science (NCAS)
Meteorology Department,
Reading University,
Earley Gate,
PO Box 243,
Reading RG6 6BB,
U.K.

tel: 0118 378 7840
fax: 0118 378 8316
e-mail: [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants