a python function to plot a geopandas dataframe

Overview

Pretty GeoDataFrame

A minimum python function (~60 lines) to draw pretty geodataframe.

Based on matplotlib, shapely, descartes.

Installation

just use the plot_gdf function

Usage example

We provide example data in sample_data directory.

from plot_gdf import plot_gdf
import matplotlib.pyplot as plt
import geopandas as gpd

gdf = gpd.read_file('./sample_data/sample_land_use_circle.shp')
drawing_kwargs = {
    'background': {'fc': '#F2F4CB', 'ec': '#dadbc1', 'hatch': 'ooo...', 'zorder': -1},
    
    'Water': {'fc': '#a1e3ff', 'ec': '#2F3737', 'hatch': 'ooo...', 'hatch_c': '#85c9e6', 'lw': 0, 'zorder': 2},
    
    'Transportation': {'fc': '#2F3737', 'ec': '#475657', 'alpha': 0.5, 'lw': 0.5, 'zorder': 2},
    
    'Others': {'fc': '#D2D68D', 'ec': '#AEB441', 'lw': .5, 'zorder': 3, 'hatch': 'ooo...'},
    
    'Farmland': {'fc': '#F2F4CB', 'ec': '#2F3737', 'lw': .5, 'zorder': 3, 'hatch': 'ooo...'},
    'Field': {'fc': '#D0F1BF', 'ec': '#2F3737', 'lw': .5, 'zorder': 3},
    
    'Special': {'fc': '#64B96A', 'ec': '#2F3737', 'lw': .5, 'zorder': 3},
    
    'Forest': {'fc': '#64B96A', 'ec': '#2F3737', 'lw': .5, 'hatch': 'ooo...', 'zorder': 3},
    'Grass': {'fc': '#8BB174', 'ec': '#2F3737', 'hatch_c': '#A7C497', 'hatch': 'ooo...', 'lw': .5, 'zorder': 3},
    

    'Public': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
    'Residential': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
    'Industrial': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
    'Commercial': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
}
fig, ax = plt.subplots(figsize = (8, 8), constrained_layout = True)
plot_gdf(gdf, ax, field='major', drawing_kwargs=drawing_kwargs)
plt.savefig('./test.png')

circle

another sample

ns

reference

inspired by https://github.com/marceloprates/prettymaps


漂亮的GeoDataFrame

在这个仓库,我们提供了一个简单的python函数(大概60行代码)来绘制漂亮的GeoDataFrame。这个函数构建在3个现有的库上即matplotlib, shapely, descartes

安装

你可以直接复制plot_gdf函数来使用这个库

使用例子

参照 Usage example. 你需要为函数提供一个GeoDataFrame,指定用于绘图的column名,以及绘图的参数。

参考

这个仓库是受到https://github.com/marceloprates/prettymaps的启发而编写的。 marceloprates的工作合并了数据获取和可视化,但是如果你已经有了地理数据,那么可以直接使用本仓库来进行绘制。

Owner
haoming
开开心心,没心没肺
haoming
paintable GitHub contribute table

githeart paintable github contribute table how to use: Functions key color select 1,2,3,4,5 clear c drawing mode mode on turn off e print paint matrix

Bahadır Araz 27 Nov 24, 2022
Python & Julia port of codes in excellent R books

X4DS This repo is a collection of Python & Julia port of codes in the following excellent R books: An Introduction to Statistical Learning (ISLR) Stat

Gitony 5 Jun 21, 2022
Browse Dash docsets inside emacs

Helm Dash What's it This package uses Dash docsets inside emacs to browse documentation. Here's an article explaining the basic usage of it. It doesn'

504 Dec 15, 2022
Example scripts for generating plots of Bohemian matrices

Bohemian Eigenvalue Plotting Examples This repository contains examples of generating plots of Bohemian eigenvalues. The examples in this repository a

Bohemian Matrices 5 Nov 12, 2022
A Graph Learning library for Humans

A Graph Learning library for Humans These novel algorithms include but are not limited to: A graph construction and graph searching class can be found

Richard Tjörnhammar 1 Feb 08, 2022
Resources for teaching & learning practical data visualization with python.

Practical Data Visualization with Python Overview All views expressed on this site are my own and do not represent the opinions of any entity with whi

Paul Jeffries 98 Sep 24, 2022
Flow-based visual scripting for Python

A simple visual node editor for Python Ryven combines flow-based visual scripting with Python. It gives you absolute freedom for your nodes and a simp

Leon Thomm 3.1k Jan 06, 2023
Matplotlib colormaps from the yt project !

cmyt Matplotlib colormaps from the yt project ! Colormaps overview The following colormaps, as well as their respective reversed (*_r) versions are av

The yt project 5 Sep 16, 2022
Tools for calculating and visualizing Elo-like ratings of MLB teams using Retosheet data

Overview This project uses historical baseball games data to calculate an Elo-like rating for MLB teams based on regular season match ups. The Elo rat

Lukas Owens 0 Aug 25, 2021
股票行情实时数据接口-A股,完全免费的沪深证券股票数据-中国股市,python最简封装的API接口

股票行情实时数据接口-A股,完全免费的沪深证券股票数据-中国股市,python最简封装的API接口,包含日线,历史K线,分时线,分钟线,全部实时采集,系统包括新浪腾讯双数据核心采集获取,自动故障切换,STOCK数据格式成DataFrame格式,可用来查询研究量化分析,股票程序自动化交易系统.为量化研究者在数据获取方面极大地减轻工作量,更加专注于策略和模型的研究与实现。

dev 572 Jan 08, 2023
An animation engine for explanatory math videos

Powered By: An animation engine for explanatory math videos Hi there, I'm Zheer 👋 I'm a Software Engineer and student!! 🌱 I’m currently learning eve

Zaheer ud Din Faiz 2 Nov 04, 2021
Generating interfaces(CLI, Qt GUI, Dash web app) from a Python function.

oneFace is a Python library for automatically generating multiple interfaces(CLI, GUI, WebGUI) from a callable Python object. oneFace is an easy way t

NaNg 31 Oct 21, 2022
Mattia Ficarelli 2 Mar 29, 2022
Arras.io Highest Scores Over Time Bar Chart Race

Arras.io Highest Scores Over Time Bar Chart Race This repo contains a python script (make_racing_bar_chart.py) that can generate a csv file which can

Road 2 Jan 16, 2022
PanGraphViewer -- show panenome graph in an easy way

PanGraphViewer -- show panenome graph in an easy way Table of Contents Versions and dependences Desktop-based panGraphViewer Library installation for

16 Dec 17, 2022
Process dataframe in a easily way.

Popanda Written by Shengxuan Wang at OSU. Used for processing dataframe, especially for machine learning. The name is from "Po" in the movie Kung Fu P

ShawnWang 1 Dec 24, 2021
A Python function that makes flower plots.

Flower plot A Python 3.9+ function that makes flower plots. Installation This package requires at least Python 3.9. pip install

Thomas Roder 4 Jun 12, 2022
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
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 2.3k Jan 04, 2023
Visualization Library

CamViz Overview // Installation // Demos // License Overview CamViz is a visualization library developed by the TRI-ML team with the goal of providing

Toyota Research Institute - Machine Learning 67 Nov 24, 2022