{"id":13936836,"url":"https://github.com/jwass/mplleaflet","last_synced_at":"2025-05-16T10:08:40.926Z","repository":{"id":16674221,"uuid":"19430044","full_name":"jwass/mplleaflet","owner":"jwass","description":"Easily convert matplotlib plots from Python into interactive Leaflet web maps.","archived":false,"fork":false,"pushed_at":"2022-03-20T20:57:46.000Z","size":1041,"stargazers_count":523,"open_issues_count":48,"forks_count":76,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-12T01:48:43.145Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-04T16:01:48.000Z","updated_at":"2025-04-30T10:44:25.000Z","dependencies_parsed_at":"2022-07-26T08:17:15.039Z","dependency_job_id":null,"html_url":"https://github.com/jwass/mplleaflet","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwass%2Fmplleaflet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwass%2Fmplleaflet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwass%2Fmplleaflet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwass%2Fmplleaflet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwass","download_url":"https://codeload.github.com/jwass/mplleaflet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-07T23:03:02.437Z","updated_at":"2025-05-16T10:08:35.918Z","avatar_url":"https://github.com/jwass.png","language":"Python","readme":"# mplleaflet\n\nmplleaflet is a Python library that converts a [matplotlib](http://matplotlib.org) plot into a webpage\ncontaining a pannable, zoomable [Leaflet](http://leafletjs.com) map. It can also [embed the Leaflet map in an IPython notebook](http://nbviewer.ipython.org/github/jwass/mplleaflet/blob/master/examples/NYC%20Boroughs.ipynb). The goal of mplleaflet is to enable use of Python and matplotlib for visualizing geographic data on [slippy maps](http://wiki.openstreetmap.org/wiki/Slippy_Map) without having to write any Javascript or HTML. You also don't need to worry about choosing the base map content i.e., coastlines, roads, etc.\n\n*Only one line of code is needed to convert a plot into a web map.*\n`mplleaflet.show()`\n\nThe library is heavily inspired by [mpld3](https://github.com/jakevdp/mpld3) and uses  [mplexporter](https://github.com/mpld3/mplexporter) to do most of the heavy lifting to walk through Figure objects.\n\n## Examples\n### Basic usage\nThe simplest use is to just create your plot using matplotlib commands and call `mplleaflet.show()`.\n\n```\n\u003e\u003e\u003e import matplotlib.pyplot as plt\n... # Load longitude, latitude data\n\u003e\u003e\u003e plt.hold(True)\n# Plot the data as a blue line with red squares on top\n# Just plot longitude vs. latitude\n\u003e\u003e\u003e plt.plot(longitude, latitude, 'b') # Draw blue line\n\u003e\u003e\u003e plt.plot(longitude, latitude, 'rs') # Draw red squares\n```\n![matplotlib x,y plot](examples/images/simple_plot.png)\n\nNormally, displaying data as longitude, latitude will cause a cartographer to cry. That's totally fine with mplleaflet, Leaflet will project your data properly.\n\n```\n# Convert to interactive Leaflet map\n\u003e\u003e\u003e import mplleaflet\n\u003e\u003e\u003e mplleaflet.show()\n```\n\n[Click to view final web page](http://htmlpreview.github.io/?https://github.com/jwass/mplleaflet/master/examples/readme_example.html)\n\n![Leaflet map preview](examples/images/simple_plot_map_preview.jpg)\n\nDisclaimer: Displaying data in spherical mercator might also cause a cartographer to cry.\n\n`show()` allows you to specify different tile layer URLs, CRS/EPSG codes, output files, etc. \n\n### IPython Notebook embedding\nJust use  `mplleaflet.display()` to embed the interactive Leaflet map in an IPython notebook.\n[Click here to see a live example.](http://nbviewer.ipython.org/github/jwass/mplleaflet/blob/master/examples/NYC%20Boroughs.ipynb)\n\n### Other examples\n* [basic_plot.py](examples/basic_plot.py): Simple line/point plotting. [View the map](http://htmlpreview.github.io/?https://github.com/jwass/mplleaflet/master/examples/basic_plot.html).\n* [quiver.py](examples/quiver.py): Demonstrates use of quiver() to plot 2-D arrows. [View the map](http://htmlpreview.github.io/?https://github.com/jwass/mplleaflet/master/examples/quiver.html).\n* [contour.py](examples/contour.py): Compute contour curves. This example demonstrates plotting in a different CRS and letting mplleaflet convert the output. [View the map](http://htmlpreview.github.io/?https://github.com/jwass/mplleaflet/master/examples/contour.html).\n* [Embedded IPython notebook example](http://nbviewer.ipython.org/github/jwass/mplleaflet/blob/master/examples/NYC%20Boroughs.ipynb)\n\n## Why mplleaflet?\nOther Python libraries, [basemap](http://matplotlib.org/basemap/) and\n[folium](https://github.com/wrobstory/folium), exist to create maps in Python. However mplleaflet allows you to leverage  all matplotlib capability without having to set up the background basemap. You can use `plot()` to style points and lines, and you can also use more complex functions like `contour()`, `quiver()`, etc. Furthermore, with mplleaflet you no longer have to worry about setting up the basemap. Displaying continents or roads is determined automatically by the zoom level required to view the physical size of the data. You should use a different library if you need fine control over the basemap, or need a geographic projection other than spherical mercator.\n\n## Installation\nInstall `mplleaflet` from PyPI using `$ pip install mplleaflet`.\n\n## Development\nIf developing for `mplleaflet`, `mplexporter` is a git submodule with its\nPython package files placed under the `mplleaflet` package. The Makefile\ncopies the files into the appropriate location.\n\n```\n$ git submodule init\n$ git submodule update\n$ make\n$ pip install -e .\n\n```\n\n## Dependencies\n* [jinja2](http://jinja.pocoo.org/)\n\nOptional\n* [pyproj](https://code.google.com/p/pyproj/) Only needed if you only use non-WGS-84 projections.\n* [GeoPandas](https://github.com/kjordahl/geopandas) To make your life easier.\n","funding_links":[],"categories":["Python","Visualization"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwass%2Fmplleaflet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwass%2Fmplleaflet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwass%2Fmplleaflet/lists"}