{ "info": { "author": "Colin Carroll", "author_email": "colcarroll@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "ridge_map\n=========\n[![Build Status](https://travis-ci.org/ColCarroll/ridge_map.svg?branch=master)](https://travis-ci.org/ColCarroll/ridge_map)\n[![Coverage Status](https://coveralls.io/repos/github/ColCarroll/ridge_map/badge.svg?branch=master)](https://coveralls.io/github/ColCarroll/ridge_map?branch=master)\n\n*Ridge plots of ridges*\n-----------------------\n\nA library for making ridge plots of... ridges. Choose a location, get an elevation map, and tinker with it to make something beautiful. Heavily inspired from [Zach Cole's beautiful art](https://twitter.com/ZachACole/status/1121554541101477889), [Jake Vanderplas' examples](https://github.com/jakevdp/altair-examples/blob/master/notebooks/PulsarPlot.ipynb), and Joy Division's [1979 album \"Unknown Pleasures\"](https://gist.github.com/ColCarroll/68e29c92b766418b0a4497b4eb2ecba4).\n\nUses [matplotlib](https://matplotlib.org/), [SRTM.py](https://github.com/tkrajina/srtm.py), [numpy](https://www.numpy.org/), and [scikit-image](https://scikit-image.org/) (for lake detection).\n\nInstallation\n------------\n\nAvailable on [PyPI](https://pypi.org/project/ridge-map/):\n\n```bash\npip install ridge_map\n```\n\nOr live on the edge and install from github with\n\n```bash\npip install git+git://github.com/colcarroll/ridge_map.git\n```\n\nWant to help?\n-------------\n\n- I feel like I am missing something easy or obvious with lake/road/river/ocean detection, but what I've got gets me most of the way there. If you hack on the `RidgeMap.preprocessor` method and find something nice, I would love to hear about it!\n- Did you make a cool map? Open an issue with the code and I will add it to the examples.\n\nExamples\n--------\n\nThe API allows you to download the data once, then edit the plot yourself,\nor allow the default processor to help you.\n\n### New Hampshire by default\n\nPlotting with all the defaults should give you a map of my favorite mountains.\n\n```python\nfrom ridge_map import RidgeMap\n\nRidgeMap().plot_map()\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/white_mountains.png?raw=true)\n\n### Download once and tweak settings\n\nFirst you download the elevation data to get an array with shape\n`(num_lines, elevation_pts)`, then you can use the preprocessor\nto automatically detect lakes, rivers, and oceans, and scale the elevations.\nFinally, there are options to style the plot\n\n```python\nrm = RidgeMap((11.098251,47.264786,11.695633,47.453630))\nvalues = rm.get_elevation_data(num_lines=150)\nvalues=rm.preprocess(\n values=values,\n lake_flatness=2,\n water_ntile=10,\n vertical_ratio=240)\nrm.plot_map(values=values,\n label='Karwendelgebirge',\n label_y=0.1,\n label_x=0.55,\n label_size=40,\n linewidth=1)\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/karwendelgebirge.png?raw=true)\n\n### Plot with colors!\n\nIf you are plotting a town that is super into burnt orange for whatever\nreason, you can respect that choice.\n\n```python\nrm = RidgeMap((-97.794285,30.232226,-97.710171,30.334509))\nvalues = rm.get_elevation_data(num_lines=80)\nrm.plot_map(values=rm.preprocess(values=values, water_ntile=12, vertical_ratio=40),\n label='Austin\\nTexas',\n label_x=0.75,\n linewidth=6,\n line_color='orange')\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/austin.png?raw=true)\n\n### Plot with even more colors!\n\nThe line color accepts a [matplotlib colormap](https://matplotlib.org/gallery/color/colormap_reference.html#sphx-glr-gallery-color-colormap-reference-py), so really feel free to go to town.\n\n```python\nrm = RidgeMap((-123.107300,36.820279,-121.519775,38.210130))\nvalues = rm.get_elevation_data(num_lines=150)\nrm.plot_map(values=rm.preprocess(values=values, lake_flatness=3, water_ntile=50, vertical_ratio=30),\n label='The Bay\\nArea',\n label_x=0.1,\n line_color = plt.get_cmap('spring'))\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/san_francisco.png?raw=true)\n\n### Plot with custom fonts and elevation colors!\n\nYou can find a good font [from Google](https://fonts.google.com/), and then get the path to the ttf file [in the github repo](https://github.com/google/fonts/tree/master/ofl).\n\nIf you pass a matplotlib colormap, you can specify `kind=\"elevation\"` to color tops of mountains different from bottoms. `ocean`, `gnuplot`, and `bone` look nice.\n\n```python\nfrom ridge_map import FontManager\n\nfont = FontManager('https://github.com/google/fonts/blob/master/ofl/uncialantiqua/UncialAntiqua-Regular.ttf?raw=True')\nrm = RidgeMap((-156.250305,18.890695,-154.714966,20.275080), font=font.prop)\n\nvalues = rm.get_elevation_data(num_lines=100)\nrm.plot_map(values=rm.preprocess(values=values, lake_flatness=2, water_ntile=10, vertical_ratio=240),\n label=\"Hawai'i\",\n label_y=0.85,\n label_x=0.7,\n label_size=60,\n linewidth=2,\n line_color=plt.get_cmap('ocean'),\n kind='elevation')\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/hawaii.png?raw=true)\n\n### How do I find a bounding box?\n\nI have been using [this website](http://bboxfinder.com). I find an area I like, draw a rectangle, then copy and paste the coordinates into the `RidgeMap` constructor.\n\n```python\nrm = RidgeMap((-73.509693,41.678682,-73.342838,41.761581))\nvalues = rm.get_elevation_data()\nrm.plot_map(values=rm.preprocess(values=values, lake_flatness=2, water_ntile=2, vertical_ratio=60),\n label='Kent\\nConnecticut',\n label_y=0.7,\n label_x=0.65,\n label_size=40)\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/kent.png?raw=true)\n\n### What about really flat areas?\n\nYou might really have to tune the `water_ntile` and `lake_flatness` to get the water right. You can set them to 0 if you do not want any water marked.\n\n```python\nrm = RidgeMap((-71.167374,42.324286,-70.952454, 42.402672))\nvalues = rm.get_elevation_data(num_lines=50)\nrm.plot_map(values=rm.preprocess(values=values, lake_flatness=4, water_ntile=30, vertical_ratio=20),\n label='Cambridge\\nand Boston',\n label_x=0.75,\n label_size=40,\n linewidth=1)\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/boston.png?raw=true)\n\n### What about Walden Pond?\n\nIt is that pleasant kettle pond in the bottom right of this map, looking entirely comfortable with its place in Western writing and thought.\n\n```python\nrm = RidgeMap((-71.418858,42.427511,-71.310024,42.481719))\nvalues = rm.get_elevation_data(num_lines=100)\nrm.plot_map(values=rm.preprocess(values=values, water_ntile=15, vertical_ratio=30),\n label='Concord\\nMassachusetts',\n label_x=0.1,\n label_size=30)\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/concord.png?raw=true)\n\n### Do you play nicely with other matplotlib figures?\n\nOf course! If you really want to put a stylized elevation map in a scientific plot you are making, I am not going to stop you, and will actually make it easier for you. Just pass an argument for `ax` to `RidgeMap.plot_map`.\n\n```python\nimport numpy as np\nfig, axes = plt.subplots(ncols=2, figsize=(20, 5))\nx = np.linspace(-2, 2)\ny = x * x\n\naxes[0].plot(x, y, 'o')\n\nrm = RidgeMap()\nrm.plot_map(label_size=24, background_color=(1, 1, 1), ax=axes[1])\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/multiaxis.png?raw=true)\n\nUser Examples\n-------------\n\n### Annotating, changing background color, custom text\n\nThis example shows how to annotate a lat/long on the map, and updates the color of the label text to allow for a dark background. Thanks to [kratsg](https://github.com/kratsg) for contributing.\n\n```python\nimport matplotlib\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nbgcolor = np.array([65,74,76])/255.\n\nscipp = (-122.060510, 36.998776)\nrm = RidgeMap((-122.087116,36.945365,-121.999226,37.023250))\nscipp_coords = ((scipp[0] - rm.longs[0])/(rm.longs[1] - rm.longs[0]),(scipp[1] - rm.lats[0])/(rm.lats[1] - rm.lats[0]))\n\nvalues = rm.get_elevation_data(num_lines=150)\nridges = rm.plot_map(values=rm.preprocess(values=values,\n lake_flatness=1,\n water_ntile=0,\n vertical_ratio=240),\n label='Santa Cruz\\nMountains',\n label_x=0.75,\n label_y=0.05,\n label_size=36,\n kind='elevation',\n linewidth=1,\n background_color=bgcolor,\n line_color = plt.get_cmap('cool'))\n\n# Bit of a hack to update the text label color\nfor child in ridges.get_children():\n if isinstance(child, matplotlib.text.Text) and 'Santa Cruz' in child._text:\n label_artist = child\n break\nlabel_artist.set_color('white')\n\nridges.text(scipp_coords[0]+0.005, scipp_coords[1]+0.005, 'SCIPP',\n fontproperties=rm.font,\n size=20,\n color=\"white\",\n transform=ridges.transAxes,\n verticalalignment=\"bottom\",\n zorder=len(values)+10)\n\nridges.plot(*scipp_coords, 'o',\n color='white',\n transform=ridges.transAxes,\n ms=6,\n zorder=len(values)+10)\n```\n\n![png](https://github.com/ColCarroll/ridge_map/blob/master/examples/santa_cruz.png?raw=true)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ColCarroll/ridge_map", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ridge-map", "package_url": "https://pypi.org/project/ridge-map/", "platform": "", "project_url": "https://pypi.org/project/ridge-map/", "project_urls": { "Homepage": "https://github.com/ColCarroll/ridge_map" }, "release_url": "https://pypi.org/project/ridge-map/0.0.2/", "requires_dist": [ "SRTM.py", "numpy", "matplotlib", "scikit-image (>=0.14.2)" ], "requires_python": "", "summary": "1d lines, 3d maps", "version": "0.0.2" }, "last_serial": 5225743, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0e8141626815f75825ec7f661a9e5459", "sha256": "2c3560c2e8d89a81c0e76e881bc013d4e6063ec538bc7aeb30e76ba461b41de2" }, "downloads": -1, "filename": "ridge_map-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0e8141626815f75825ec7f661a9e5459", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8789, "upload_time": "2019-05-03T23:44:40", "url": "https://files.pythonhosted.org/packages/33/a8/f27f74bc7f2339f845d29aeb318891eba7fd4f79b07f0cee38b6dfc3dc08/ridge_map-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9281bb317d52f66afcdbee97e41893e", "sha256": "8d1d89e7a92f7dbdc9edefeb4a0ade39f2fa302414f6629623f050ff57656c89" }, "downloads": -1, "filename": "ridge_map-0.0.1.tar.gz", "has_sig": false, "md5_digest": "c9281bb317d52f66afcdbee97e41893e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8139, "upload_time": "2019-05-03T23:44:42", "url": "https://files.pythonhosted.org/packages/cf/be/f0807b942032d5f640d05bf43fd5883557c578a334dcdaca782629a07d34/ridge_map-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b10548942fd73e6edf1d76fe9d0f3791", "sha256": "b35c215c8d2abf6b73a31ceae7bf5ff2b3cd8757f7290dfccba200316025a5fc" }, "downloads": -1, "filename": "ridge_map-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b10548942fd73e6edf1d76fe9d0f3791", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9130, "upload_time": "2019-05-04T14:43:40", "url": "https://files.pythonhosted.org/packages/10/dd/e2e8d608dd2b130f4973833688d541991f7052916cebc3072a7dbe87c932/ridge_map-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "432272cdb37704102206e270128e5614", "sha256": "32dbde1a98484b73a15450a0c930ce76f169f45bf8318cfe0e06bcaacca49ca0" }, "downloads": -1, "filename": "ridge_map-0.0.2.tar.gz", "has_sig": false, "md5_digest": "432272cdb37704102206e270128e5614", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8860, "upload_time": "2019-05-04T14:43:41", "url": "https://files.pythonhosted.org/packages/e1/c8/9890fa1298e747b2bad2fa616423fde5573a452343a2a31c2658bc4ea193/ridge_map-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b10548942fd73e6edf1d76fe9d0f3791", "sha256": "b35c215c8d2abf6b73a31ceae7bf5ff2b3cd8757f7290dfccba200316025a5fc" }, "downloads": -1, "filename": "ridge_map-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b10548942fd73e6edf1d76fe9d0f3791", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9130, "upload_time": "2019-05-04T14:43:40", "url": "https://files.pythonhosted.org/packages/10/dd/e2e8d608dd2b130f4973833688d541991f7052916cebc3072a7dbe87c932/ridge_map-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "432272cdb37704102206e270128e5614", "sha256": "32dbde1a98484b73a15450a0c930ce76f169f45bf8318cfe0e06bcaacca49ca0" }, "downloads": -1, "filename": "ridge_map-0.0.2.tar.gz", "has_sig": false, "md5_digest": "432272cdb37704102206e270128e5614", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8860, "upload_time": "2019-05-04T14:43:41", "url": "https://files.pythonhosted.org/packages/e1/c8/9890fa1298e747b2bad2fa616423fde5573a452343a2a31c2658bc4ea193/ridge_map-0.0.2.tar.gz" } ] }