项目作者: pblankley

项目描述 :
Library to translate a lat-long box to a JoyPlot plot
高级语言: Python
项目地址: git://github.com/pblankley/geo-joyplot.git
创建时间: 2018-10-30T16:17:07Z
项目社区:https://github.com/pblankley/geo-joyplot

开源协议:MIT License

下载


Geography to JoyPlot

This is a little library (one function) to translate a lat-long box to a JoyPlot plot using the joypy library and the Google Elevation API.

Installation

  1. git clone https://github.com/pblankley/geo-joyplot
  2. cd geo-joyplot
  3. python setup.py install

Example

After you install the library, you can use it as follows:

  1. import joypy
  2. import matplotlib.cm as cm
  3. import matplotlib.pyplot as plt
  4. import geo_joyplot
  5. GOOGLE_API = '<API-KEY>'
  6. top_left = (38.9439, -106.3746)
  7. bot_right = (38.8253, -106.1966)
  8. # Get the plotting pandas dataframe
  9. plot_df = geo_joyplot.get_plot_df(top_left, bot_right, api_key=GOOGLE_API, n_vert=50, n_horiz=100)
  10. # Plot with the joypy library
  11. fig,ax = plt.subplots(figsize=(10,8))
  12. joypy.joyplot(plot_df, by='lat_o', column='lng', \
  13. xlabels=False, ylabels=False, \
  14. colormap=cm.gist_earth_r, linewidth=0.5, alpha=0.7,\
  15. fill=True, linecolor='#3d4447', ax=ax, overlap=2.5);
  16. plt.show()

Running this should result in the following image of the Sawatch range near Leadville, CO!



Have fun, and open an issue if there are problems.