pysal / segregation

Segregation Measurement, Inferential Statistics, and Decomposition Analysis
https://pysal.org/segregation/
BSD 3-Clause "New" or "Revised" License
112 stars 26 forks source link

plots should return fig/ax for composability #108

Closed knaaptime closed 3 years ago

knaaptime commented 5 years ago

most of the plotting functionality started as a convenience for ourselves, but now that we're using them more often we need to make sure we're returning at least the axes object so users can edit/save/combine plots, etc

renanxcortes commented 5 years ago

Yes, got it... What you're referring is that right now we cannot do something like:

import libpysal
import geopandas as gpd
import numpy as np
from segregation.aspatial import Dissim
from segregation.decomposition import DecomposeSegregation

s_map = gpd.read_file(libpysal.examples.get_path("sacramentot2.shp"))
index1 = Dissim(s_map, 'HISP_', 'TOT_POP')
index2 = Dissim(s_map, 'BLACK_', 'TOT_POP')
res = DecomposeSegregation(index1, index2, counterfactual_approach = "composition")
ax = res.plot(plot_type = 'cdfs')
ax.set_title('Other Title')

Right?

knaaptime commented 5 years ago

exactly

renanxcortes commented 5 years ago

Partially solved with https://github.com/pysal/segregation/pull/109 for the inference wrappers. There's still plotting methods for the decomposition and for some indexes such as Concentration Profile and Spatial Proximity Profile.