Skip to content
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

projection=gcrs.OSGB() sometimes creates a blank plot #248

Open
data-wombat opened this issue Aug 12, 2021 · 1 comment
Open

projection=gcrs.OSGB() sometimes creates a blank plot #248

data-wombat opened this issue Aug 12, 2021 · 1 comment
Labels

Comments

@data-wombat
Copy link

data-wombat commented Aug 12, 2021

Apologies if this turns out to be a cartopy issue (I'm not deeply familiar with cartopy), but after digging around, I can't find anyone else running into it.

I'm hitting two odd edge cases where setting projection=gcrs.OSGB() creates a blank plot, but AlbersEqualArea() plots fine.

  1. A GeoDataFrame read from the following (Great Britain and Northern Ireland borders), dropping Northern Ireland with .dropna([11]) plots when extent is set but not when it's omitted. AlbersEqualArea() plots fine without extent.
gplt.polyplot(
    uk_borders_partial,
    zorder=1,
    projection=gcrs.OSGB(approx=False),
    extent=uk_borders_partial.total_bounds,
    edgecolor='gray',
    figsize=(12,12)
    )
  1. Setting the previous to ax= and tacking on the following KDEPlot creates a blank plot if clip=uk_borders_partial (Northern Ireland is dropped). Using the full GeoDataFrame or any subset of the full GeoDataFrame that does not drop Northern Ireland, e.g. uk_borders_full[5:12], plots exactly as expected. The code, with Ireland dropped, also plots as expected with AlbersEqualArea(). Just not with OSGB().
gplt.kdeplot(
    lichen_2011_11,
    clip=uk_borders_partial,
    projection=gcrs.OSGB(approx=False),
    cmap='Reds',
    shade=True,
    ax=ax,
    extent=uk_borders_partial.total_bounds,
    )

Would the latter be an issue with how clip gets passed to seaborn kdeplot?

Thank you for your help, and for this beautiful library.

@ResidentMario
Copy link
Owner

ResidentMario commented Aug 13, 2021

That is some really weird behavior! gcrs.OSGB() is a thin wrapper around the cartopy OSGB projection, so I'd implicate cartopy in these problem. Thanks for bringing a repro, I'll try to fiddle with it something. Sadly I'm not a cartopy expert, and the lifetime of the geoplot library has been filled with occasional and inexplicable quirks like this one, so I don't know how helpful I can be.

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

No branches or pull requests

2 participants