basemap - Plot on map projections (with coastlines and political boundaries) using matplotlib.

Overview

Basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib.

⚠️ Warning: this package is being deprecated in favour of cartopy.

Requirements

  • Python 2.6 (or higher)

  • matplotlib

  • numpy

  • pyproj

  • pyshp

  • The GEOS (Geometry Engine - Open Source) library (version 3.1.1 or higher). Source code is included in the geos-3.3.3 directory.

  • On Linux, if your Python was installed via a package management system, make sure the corresponding python-dev package is also installed. Otherwise, you may not have the Python header (Python.h), which is required to build Python C extensions.

Optional

  • OWSLib (optional) It is needed for the BaseMap.wmsimage function.

  • Pillow (optional) It is needed for Basemap warpimage, bluemarble, shadedrelief, and etop methods. PIL should work on Python 2.x. Pillow is a maintained fork of PIL.

Copyright

Source code for the GEOS library is included in the geos-3.3.3 directory under the terms given in LICENSE_geos.

The land-sea mask, coastline, lake, river and political boundary data are extracted from datasets provided with the Generic Mapping Tools (GMT) and are included under the terms given in LICENSE_data.

Everything else (including src/_geos.c and src/_geos.pyx) is licensed under the terms given in LICENSE:

Copyright (C) 2011 Jeffrey Whitaker

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notices appear in all copies and that both the copyright notices and this permission notice appear in supporting documentation.

THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Documentation

See http://matplotlib.github.com/basemap/

See scripts in examples directory for example usage.

Read the FAQ and/or email the matplotlib-users mailing list if you have problems or questions.

Install

  1. Install pre-requisite Python modules numpy and matplotlib.

  2. Then download basemap-X.Y.Z.tar.gz (approx 100 MB) from the GitHub Releases page, unpack and cd to basemap-X.Y.Z.

  3. Install the GEOS library. If you already have it on your system, just set the environment variable GEOS_DIR to point to the location of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and geos_c.h is in /usr/local/include, set GEOS_DIR to /usr/local). Then go to step (3). If you don't have it, you can build it from the source code included with basemap by following these steps:

     > cd geos-3.3.3
     > export GEOS_DIR=<where you want the libs and headers to go>
       A reasonable choice on a Unix-like system is /usr/local, or
       if you don't have permission to write there, your home directory.
     > ./configure --prefix=$GEOS_DIR
     > make; make install
    
  4. cd back to the top level basemap directory (basemap-X.Y.Z) and run the usual python setup.py install. Check your installation by running "from mpl_toolkits.basemap import Basemap" at the Python prompt.

  5. To test, cd to the examples directory and run python simpletest.py. To run all the examples (except those that have extra dependencies or require an internet connection), execute python run_all.py.

An alternative method is using pip:

pip install --user git+https://github.com/matplotlib/basemap.git

Contact

Ben Root [email protected]

Thanks

Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Jonas Bluethgen, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions.

Comments
  • pip error on Macbook pro (m1 pro)

    pip error on Macbook pro (m1 pro)

    Hi! I am working on Macbook pro with basemap, but I met some issues. When I try to pip install basemap, there is something wrong with this. But I have already brew install geos, what's wrong? Thanks! image

    opened by CaffreyR 32
  • KeyError 'PROJ_LIB'

    KeyError 'PROJ_LIB'

    I install basemap with the command conda install basemap -c conda-forge

    but

    from mpl_toolkits.basemap import Basemap
    

    returns:

    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    <ipython-input-23-212c45f90d40> in <module>()
    ----> 1 from mpl_toolkits.basemap import Basemap
          2 #import matplotlib.pyplot as plt
          3 import numpy as np
    
    /srv/conda/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
        144 
        145 # create dictionary that maps epsg codes to Basemap kwargs.
    --> 146 pyproj_datadir = os.environ['PROJ_LIB']
        147 epsgf = open(os.path.join(pyproj_datadir,'epsg'))
        148 epsg_dict={}
    
    /srv/conda/lib/python3.6/os.py in __getitem__(self, key)
        667         except KeyError:
        668             # raise KeyError with the original key value
    --> 669             raise KeyError(key) from None
        670         return self.decodevalue(value)
        671 
    
    KeyError: 'PROJ_LIB'
    
    opened by statiksof 32
  • wrapping of longitude

    wrapping of longitude

    I am trying to scatter plot on maps with nonzero middle longitude, but the areas where the map is "wrapped" are not plotted.

    My test script:


    from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt

    m = Basemap(lon_0=160) m.fillcontinents()

    for x in range(-179, 179):
    px1, py1 = m(x, x/4.0) m.scatter(px1,py1, zorder=3)

    plt.show()


    If lon_0 is zero it works fine but with non-zero lat_0 some areas are not plotted.

    It seems like the m(lon,lat) is not wrapping the points, the points I expect to wrap are negative in px1?

    Or am I missing some transformation step?

    opened by petrushy 32
  • Some possibility of installation

    Some possibility of installation

    Dear community, and possible people suffering as well,

    I also have struggles for installing basemap, especially with python3.6 (default shipped with Ubuntu 18.04) After several tries like using cartopy, using apt install to install cartopy and basemap. None of them works quickly for python3.6.

    In the end it works for this "simple" way:

    1. Installing pyproj (3.0.0) by python3 -m pip install pyproj==3.0
    2. installing matplotlib by python3 -m pip install matplotlib==3.3.3
    3. downloading the basemap 1.2.2 version and install also by python3 -m pip install . in the basemap untar folder.

    Hope this helps.

    opened by hydrogencl 30
  • Arcgisimage fails

    Arcgisimage fails

    I tried a simple map and add some arcgisimage, but it failed.

    Here is the code:

    m=Basemap(projection='cyl',llcrnrlon=-90,llcrnrlat=30,urcrnrlon=-60,urcrnrlat=60)
    m.arcgisimage(verbose=True)
    plt.show()
    

    And the error:

    Traceback (most recent call last):
      File "/home/bastien/PycharmProjects/untitled/rider_analysis.py", line 55, in <module>
        m.arcgisimage(verbose=True)
      File "/usr/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 4270, in arcgisimage
        return self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
      File "/usr/lib/python3.5/site-packages/matplotlib/image.py", line 1326, in imread
        return handler(fname)
    SystemError: <built-in function read_png> returned NULL without setting an error
    
    Process finished with exit code 1
    

    After debugging around, I found that imread does not like http.request.HttpResponse, but works fine with file path.

    Regards,

    Bastien

    opened by bjacotg 19
  • Problem on installation 1.3.1 with sdist

    Problem on installation 1.3.1 with sdist

    Environment macOS Monterey Version 12.1 Chip Apple M1 Max Python 3.10.1

    With the goes library as below

    brew install geos
    export $GEOS_DIR=/opt/homebrew/Cellar/geos/3.10.2/
    /opt/homebrew/Cellar/geos/3.10.2/
    

    I tried to install basemap following the comments on #531

    poetry add basemap
    # same symptom with pip
    

    but installation failed with error

    EnvCommandError
    
      Command ['/Users/yuujin/Workspace/.venv/bin/pip', 'install', '--no-deps', 'file:///Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip'] errored with the following return code 1, and output: 
      Processing /Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip
        Preparing metadata (setup.py): started
        Preparing metadata (setup.py): finished with status 'error'
        ERROR: Command errored out with exit status 1:
         command: /Users/yuujin/Workspace/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py'"'"'; __file__='"'"'/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-pip-egg-info-548b08zr
             cwd: /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/
        Complete output (9 lines):
        /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py:52: RuntimeWarning: Cannot find GEOS library and/or headers in standard locations ('/opt/homebrew/Cellar/geos/3.10.2/'). Please install the corresponding packages using your software management system or set the environment variable GEOS_DIR to point to the location where GEOS is installed (for example, if 'geos_c.h' is in '/usr/local/include' and 'libgeos_c' is in '/usr/local/lib', then you need to set GEOS_DIR to '/usr/local'
          warnings.warn(" ".join([
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py", line 149, in <module>
            dev_requires = get_content("requirements-dev.txt", splitlines=True)
          File "/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py", line 23, in get_content
            with io.open(path, encoding="utf-8") as fd:
        FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/requirements-dev.txt'
        ----------------------------------------
      WARNING: Discarding file:///Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
      ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    

    Even there exist header and built binary 'geos_c.h' and 'libgeos_c' in $GEOS_DIR

    opened by YuujinHwang 18
  • shiftdata exception when using latlon=True for scatter

    shiftdata exception when using latlon=True for scatter

    The exception;

    m.scatter(x, y,50,marker='o',color='g',latlon=True, zorder=10)
      File Anaconda\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 536, in with_transform
        x = self.shiftdata(x)
      File "Anaconda\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4777, in shiftdata
        if itemindex:
    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
    

    There seems to be a mismatch when using latlon that shiftdata does not expect. This can be mitigated by getting the projection coordinates before applying the operation; example below.

    from mpl_toolkits.basemap import Basemap
    import numpy as np
    import matplotlib.pyplot as plt
    
    def valueError():
        m = Basemap(projection='robin',lon_0=115,resolution='c')
        m.drawcoastlines()
        m.fillcontinents(color='sienna',lake_color='aqua')
        m.drawmapboundary(fill_color='lightsteelblue')
    
        x = [-5.435, -6.660817, -119.2511944, 17.719833]
        y = [36.136, 4.746717, 39.4030278, -14.657583]
        m.scatter(x, y,50,marker='o',color='g',latlon=True, zorder=10)
        plt.show()
    
    def works():
        m = Basemap(projection='robin',lon_0=115,resolution='c')
        m.drawcoastlines()
        m.fillcontinents(color='sienna',lake_color='aqua')
        m.drawmapboundary(fill_color='lightsteelblue')
        x = [-5.435, -6.660817, -119.2511944, 17.719833]
        y = [36.136, 4.746717, 39.4030278, -14.657583]
    
        x,y = m(x,y)
        m.scatter(x, y,50,marker='o',color='g',latlon=False, zorder=10)
        plt.show()
    
    def main():
        works()
        valueError()
    
    if __name__ == '__main__':
        main()
    
    opened by benranck 18
  • AttributeError: can't set attribute   ax._hold = self._tmp_hold

    AttributeError: can't set attribute ax._hold = self._tmp_hold

    Bug report

    Bug summary

    Basemap cannot work when I update the matplotlib to the new version 3.0.1.

    Code for reproduction

    import matplotlib.pyplot as plt
    import numpy as np
    from mpl_toolkits.basemap import Basemap
    
    outfile = r'E:\wrong.tif'
    
    # read in data on lat/lon grid.
    # data from https://github.com/matplotlib/basemap/tree/master/examples
    hgt = np.loadtxt(r'E:\tmp\basemap\500hgtdata.gz')
    lons = np.loadtxt(r'E:\tmp\basemap\500hgtlons.gz')
    lats = np.loadtxt(r'E:\tmp\basemap\500hgtlats.gz')
    lons, lats = np.meshgrid(lons, lats)
    
    mnh = Basemap(lon_0=-105, boundinglat=20.,
                  resolution='c', area_thresh=10000., projection='nplaea')
    xnh, ynh = mnh(lons, lats)
    CS = mnh.contour(xnh, ynh, hgt, 15, linewidths=0.5, colors='k')
    CS = mnh.contourf(xnh, ynh, hgt, 15, cmap=plt.cm.Spectral)
    
    mnh.drawcoastlines(linewidth=0.5)
    delat = 30.
    circles = np.arange(0., 90., delat).tolist() + \
              np.arange(-delat, -90, -delat).tolist()
    mnh.drawparallels(circles, labels=[1, 0, 0, 0])
    delon = 45.
    meridians = np.arange(0, 360, delon)
    mnh.drawmeridians(meridians, labels=[1, 0, 0, 1])
    plt.title('NH 500 hPa Height (cm.Spectral)')
    
    # colorbar on bottom.
    mnh.colorbar(pad='5%')
    plt.savefig(outfile, dpi=300, bbox_inches='tight')  
    plt.show()
    

    Actual outcome

    # If applicable, paste the console output here
    
    Traceback (most recent call last):
      File "E:/MyWork/code/python/psta/tmp.py", line 20, in <module>
        CS = mnh.contour(xnh, ynh, hgt, 15, linewidths=0.5, colors='k')
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 542, in with_transform
        return plotfunc(self,x,y,data,*args,**kwargs)
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3566, in contour
        self._restore_hold(ax)
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3229, in _restore_hold
        ax._hold = self._tmp_hold
    AttributeError: can't set attribute
    

    Expected outcome

    Matplotlib version

    • Operating system: Windows 10 x64
    • Matplotlib version: 3.0.1
    • Matplotlib backend (print(matplotlib.get_backend())): module://backend_interagg
    • Python version: 3.6.6
    • Jupyter version (if applicable): None
    • basemap version: 1.2.0
    • PyCharm version: 2018.2.4

    I install matplotlib and basemap from https://www.lfd.uci.edu/~gohlke/pythonlibs.

    opened by jiaozhh 17
  • Travis-CI:  Use  APT to install GEOS

    Travis-CI: Use APT to install GEOS

    Install libgeos using apt would probably save almost 4 minutes of build time. There is also a newer version of GEOS already packaged.

    In .travis.yaml replace the compiling of libgeos with this:

    addons:
      apt:
        packages:
        - libgeos-3.3.8
    

    Here are the docs for APT on Travis.

    I'm putting this here until I can get PR #234 working and merged.

    opened by micahcochran 17
  • geos projection cannot cross pole

    geos projection cannot cross pole

    Defining a Basemap in geostationary projection,

    >>> from mpl_toolkits.basemap import Basemap
    >>> Basemap(projection='geos', lon_0=0)
    

    fails in basemap-1.1.0 with the following error:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "...lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1109, in __init__
    self._readboundarydata('gshhs',as_polygons=True)
      File "...lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1241, in _readboundarydata
    raise ValueError('%s projection cannot cross pole'%(self.projection))
    ValueError: geos projection cannot cross pole
    
    opened by sfinkens 16
  • Use APT for libgeos on Travis

    Use APT for libgeos on Travis

    This is for issue #235 . Using the APT binary versions of libgeos speed up Travis test times by eliminating some of the compiling. Also, dashes were added to install steps to show the install timea for dependent packages.

    In testing, the overall Travis test time is about the same. It adds two additional tests builds.

    The way this is setup APT installs these period. setup.py does not have a way to force local libgeos install, which is probably not a bad thing.

    opened by micahcochran 15
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi matplotlib/basemap!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! Whilst we've attempted to make use of the existing configuration that you had on LGTM.com, there may be some differences in environment used to build the project. We hope that in most cases it will not require significant changes to achieve a successful analysis. Check this page for detailed documentation on how to configure a CodeQL workflow.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • [Doc]: (More) Clearly mark Basemap as deprecated

    [Doc]: (More) Clearly mark Basemap as deprecated

    Documentation Link

    No response

    Problem

    Basemap is deprecated and all users should be using Cartopy.

    In 2020, https://github.com/matplotlib/matplotlib/pull/16495 removed references to Basemap from matplotlib's documentation. Is it now time to more clearly mark Basemap as deprecated on https://matplotlib.org/basemap/ ?

    I do see that the deprecation is described at the bottom of https://matplotlib.org/basemap/ but:

    1. this statement can be missed (I recently met a user that had missed the information);
    2. the statement is only on the main Basemap doc page, not in pages linked from there (random example https://matplotlib.org/basemap/users/mapsetup.html).

    Suggested improvement

    Place bold/red warning statements on all pages of the Basemap documentation, starting from https://matplotlib.org/basemap/

    opened by TomLav 5
  • Filling ocean with Natural Earth shapefile does not produce the right result

    Filling ocean with Natural Earth shapefile does not produce the right result

    As per https://stackoverflow.com/questions/74433797/fill-oceans-in-high-resolution-to-hide-low-resolution-contours-in-basemap I'm trying to fill the ocean with high resolution polygons to mask out some low resolution filled contours. Unfortunately the built-in land sea mask of basemap is not enough for zoomed in regions.

    For this reason I'm trying to fill the ocean shapefiles of natural earth https://www.naturalearthdata.com/downloads/10m-physical-vectors/ using the following code

    m = Basemap(projection='merc',
                    llcrnrlat=36,
                    urcrnrlat=47,
                    llcrnrlon=6,
                    urcrnrlon=19,
                    lat_ts=20,
                    resolution='h')
    
    shp = m.readshapefile('../input/shapefiles/ne_10m_ocean/ne_10m_ocean',
                    'ne_10m_ocean', drawbounds = True)
    patches   = []
    for info, shape in zip(m.ne_10m_ocean_info, m.ne_10m_ocean):
        patches.append( Polygon(np.array(shape), True) )
            
    plt.gca().add_collection(PatchCollection(patches, facecolor= 'red', edgecolor='k', linewidths=1., zorder=2))
    

    This, however, does also fill some of the major islands with the same color of the ocean, as the following figure shows.

    Screen Shot 2022-11-14 at 17 06 08

    Am I doing something wrong? I checked the original shapefile and the polygons seem to be well defined. Here is the same plot done with Cartopy

    f557a896-d051-4e2e-a89c-3e40d0e9d679

    opened by guidocioni 0
  • Some countries borders not showing up in map

    Some countries borders not showing up in map

    I remember seeing this already a long time ago but I never managed to solve it.

    I'm plotting a map using this

    m = Basemap(projection='merc',
                    llcrnrlat=extents[2],
                    urcrnrlat=extents[3],
                    llcrnrlon=extents[0],
                    urcrnrlon=extents[1],
                    lat_ts=20,
                    resolution='h')
    
    m.fillcontinents(color='lightgray', lake_color='#2081C3', zorder=1)
    m.drawlsmask(land_color=(0, 0, 0, 0), ocean_color='#2081C3',
                     resolution='f', lakes=True, zorder=2, grid=1.25)
    
    ax = plt.gca()
    
    m.drawcountries(linewidth=0.8)
    m.drawcoastlines()
    
    m.readshapefile(f'{SHAPEFILES_DIR}/ITA_adm_shp/ITA_adm1',
                            'ITA_adm1', linewidth=0.8, color='black', zorder=5)
    
    

    but some countries (like Switzerland) don't show up.

    realtime_wind_italia

    Weirdly enough when centering the projection over France Switzerland shows up

    realtime_wind_francia

    opened by guidocioni 4
  • Enable flake8

    Enable flake8

    In the context of fixing current issues within basemap, one easy step is to use static analysis tools, since they can catch the most evident problems.

    I open this issue as a reminder to enable flake8 in the development workflow; flake8 will catch the most evident code mistakes, and it will also give advice on changes that will make the code more pep8-compliant. Enabling pylint at this moment is not recommended, because it will complain too much.

    opened by molinav 2
Releases(v1.3.6)
  • v1.3.6(Oct 31, 2022)

    This is a patch release that fixes the following issues:

    • Add support for Python 3.11.
    • Set MSVC 14.0 (VS2015) to build the GEOS library bundled in the precompiled Windows wheels.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.5(Oct 25, 2022)

    This is a patch release that fixes the following issues:

    • Fix broken array slicing inside addcyclic (thanks to @fragkoul).
    • Fix GeosLibrary wrapper to also work with GEOS >= 3.7.0 on Windows and GNU/Linux.
    • Fix wrong Antarctica coastline boundary with GEOS >= 3.9.0.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.4(Aug 11, 2022)

    This is a patch release that fixes the following issues:

    • Fix broken implementation of Basemap.arcgisimage.
    • Fix numpy requirement to ensure that builds also work on MacOS (thanks to @SongJaeIn for testing).
    • Enforce newer numpy and pillow versions when possible due to several vulnerabilities.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.3(May 12, 2022)

    This is a patch release that fixes the following issues:

    • Fix issue in drawcoastlines with shape of vertices array (thanks to @guziy).
    • Fix setup to identify GEOS dylib on MacOS correctly (thanks to @ronaldbradford and @CaffreyR for testing).
    • Remove dependency on six.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.2(Feb 10, 2022)

    This is a patch release that fixes the following issues:

    • Fix unusable source distribution file due to missing MANIFEST file (thanks to @DWesl).
    • Enforce newer numpy and pillow versions when possible due to several vulnerabilities.
    • Remove the deprecation notices.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Jan 22, 2022)

    This is a patch release that fixes the following issues:

    • Provide support for Python 3.10 on Windows and GNU/Linux (x86 and x64).
    • Provide precompiled binary wheels for Python 3.10 on Windows and GNU/Linux (x86 and x64).
    • Improve the error message shown when requesting high- or full-resolution datasets and basemap-data-hires is not installed.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Dec 29, 2021)

    This release focuses on the packaging of the library. In summary:

    • The library is split in three parts: basemap, basemap-data and basemap-data-hires.
    • Precompiled wheels for the three packages are available in PyPI.
    • Licensing is updated and clarified. The base license is MIT, with other components whose license is LGPL-2.1-only or LGPL-3.0-or-later.
    • Main branch is moved to the name develop, while master is kept for creating releases. Please submit future PR to the develop branch.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2rel(Aug 6, 2020)

    This is quite likely the last release ever of basemap. Please move development efforts over to Cartopy!

    This release fixes some incompatibilities with matplotlib v3.3+ and also newer versions of libgeos (tested against v1.6.1). Also fixes some incompatibilities with the make.py.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(May 4, 2017)

Owner
Matplotlib Developers
Matplotlib Developers
This is a small repository for me to implement my simply Data Visualisation skills through Python.

Data Visualisations This is a small repository for me to implement my simply Data Visualisation skills through Python. Steam Population Chart from 10/

9 Dec 31, 2021
A command line tool for visualizing CSV/spreadsheet-like data

PerfPlotter Read data from CSV files using pandas and generate interactive plots using bokeh, which can then be embedded into HTML pages and served by

Gino Mempin 0 Jun 25, 2022
Python package that generates hardware pinout diagrams as SVG images

PinOut A Python package that generates hardware pinout diagrams as SVG images. The package is designed to be quite flexible and works well for general

336 Dec 20, 2022
HiPlot makes understanding high dimensional data easy

HiPlot - High dimensional Interactive Plotting HiPlot is a lightweight interactive visualization tool to help AI researchers discover correlations and

Facebook Research 2.4k Jan 04, 2023
This is a web application to visualize various famous technical indicators and stocks tickers from user

Visualizing Technical Indicators Using Python and Plotly. Currently facing issues hosting the application on heroku. As soon as I am able to I'll like

4 Aug 04, 2022
Visualize tensors in a plain Python REPL using Sparklines

Visualize tensors in a plain Python REPL using Sparklines

Shawn Presser 43 Sep 03, 2022
This GitHub Repository contains Data Analysis projects that I have completed so far! While most of th project are focused on Data Analysis, some of them are also put here to show off other skills that I have learned.

Welcome to my Data Analysis projects page! This GitHub Repository contains Data Analysis projects that I have completed so far! While most of th proje

Kyle Dini 1 Jan 31, 2022
Python scripts for plotting audiograms and related data from Interacoustics Equinox audiometer and Otoaccess software.

audiometry Python scripts for plotting audiograms and related data from Interacoustics Equinox 2.0 audiometer and Otoaccess software. Maybe similar sc

Hamilton Lab at UT Austin 2 Jun 15, 2022
AB-test-analyzer - Python class to perform AB test analysis

AB-test-analyzer Python class to perform AB test analysis Overview This repo con

13 Jul 16, 2022
Altair extension for saving charts in a variety of formats.

Altair Saver This packge provides extensions to Altair for saving charts to a variety of output types. Supported output formats are: .json/.vl.json: V

Altair 85 Dec 09, 2022
Parallel t-SNE implementation with Python and Torch wrappers.

Multicore t-SNE This is a multicore modification of Barnes-Hut t-SNE by L. Van der Maaten with python and Torch CFFI-based wrappers. This code also wo

Dmitry Ulyanov 1.7k Jan 09, 2023
Datapane is the easiest way to create data science reports from Python.

Datapane Teams | Documentation | API Docs | Changelog | Twitter | Blog Share interactive plots and data in 3 lines of Python. Datapane is a Python lib

Datapane 744 Jan 06, 2023
Standardized plots and visualizations in Python

Standardized plots and visualizations in Python pltviz is a Python package for standardized visualization. Routine and novel plotting approaches are f

Andrew Tavis McAllister 0 Jul 09, 2022
Library for exploring and validating machine learning data

TensorFlow Data Validation TensorFlow Data Validation (TFDV) is a library for exploring and validating machine learning data. It is designed to be hig

688 Jan 03, 2023
High-level geospatial data visualization library for Python.

geoplot: geospatial data visualization geoplot is a high-level Python geospatial plotting library. It's an extension to cartopy and matplotlib which m

Aleksey Bilogur 1k Jan 01, 2023
Focus on Algorithm Design, Not on Data Wrangling

The dataTap Python library is the primary interface for using dataTap's rich data management tools. Create datasets, stream annotations, and analyze model performance all with one library.

Zensors 37 Nov 25, 2022
Automatically generate GitHub activity!

Commit Bot Automatically generate GitHub activity! We've all wanted to be the developer that commits every day, but that requires a lot of work. Let's

Ricky 4 Jun 07, 2022
Eulera Dashboard is an easy and intuitive way to get a quick feel of what’s happening on the world’s market.

an easy and intuitive way to get a quick feel of what’s happening on the world’s market ! Eulera dashboard is a tool allows you to monitor historical

Salah Eddine LABIAD 4 Nov 25, 2022
Visualize large time-series data in plotly

plotly_resampler enables visualizing large sequential data by adding resampling functionality to Plotly figures. In this Plotly-Resampler demo over 11

PreDiCT.IDLab 604 Dec 28, 2022
Numerical methods for ordinary differential equations: Euler, Improved Euler, Runge-Kutta.

Numerical methods Numerical methods for ordinary differential equations are methods used to find numerical approximations to the solutions of ordinary

Aleksey Korshuk 5 Apr 29, 2022