mobilkit.viz module
- mobilkit.viz.compareLinePlot(x_scatter, x_line, y, data, xlim=None, ylim=None, xlabel=None, ylabel=None, doScatter=True, doLine=True, scatterkws={}, lineplotkws={}, figsize=(7, 4), ax=None)
Compares a scattered data with its line estimated.
- Parameters:
x_scatter, x_line, y (str) – The columns to use for x in the scatter and line plot (in the line plot you might want to use a binned version of the x) and as y.
data (pd.Dataframe) – The dataframe to use.
xlim, ylim (tuple, optional) – The limits to put in the x and y axis.
xlabel, ylabel (str, optional) – The x and y axis labels
scatterkws (dict, optional) – The keywords to pass to seaborn.scatterplot. By default thay are: {‘alpha’:.075}
lineplotkws (dict, optional) – The keywords to pass to seaborn.lineplot. By default thay are: `{‘color’:’C3’,
‘estimator’:lambda g: np.percentile(g, 50), ‘n_boot’:200}`
figsize (tuple, optional) – The figure size in inches.
- Returns:
fig, ax – The figure and axes handle.
- Return type:
tuple
- mobilkit.viz.plot_density_map(latitudes, longitudes, center, bins, radius, ax=None, annotations=None)
- Parameters:
latitudes, longitudes (array-like) – Array contaning the lat and lon coordinates of each user on a selected day.
center (tuple-like) – The (lat, lon) of the center where to compute the population density around.
bins (int) – The number of bins to use horizontally and vertically in the region around the center.
radius (float) – The space to consider above, below, left and right of the center (same unity of the center).
ax (matplotlib.axes) – The axes to use. If None a new figure will be created.
annotations (dict) – A dictionary of annotations to be put on the map in the form of {“Text”: {kwargs to ax.annotate} }. Will be used as ax.annotate(key, **value).
- Returns:
The putput of ax.hist2d and the axis itself.
- Return type:
res, ax
- mobilkit.viz.plot_pop(df, title, empiric_pop='POBTOT', data_pop='POP_HFLB', alpha=0.1, verbose=True)
Plot the scatter-plot between empiric_pop and data_pop columns.
- Parameters:
df (pandas.DataFrame) – As dataframe containing the two columns selected.
- mobilkit.viz.shori_density_map(data, xbins, ybins, ax=None, annotations=None, vmin=-2, vmax=2)
- Parameters:
data (array-like) – Array contaning the raster of the population density to be plot.
xbins, ybins (array-like) – The bins used to construct the raster. Will be used to limit the plot area.
ax (matplotlib.axes) – The axes to use. If None a new figure will be created.
annotations (dict) – A dictionary of annotations to be put on the map in the form of {“Text”: {kwargs to ax.annotate} }. Will be used as ax.annotate(key, **value).
vmin, vmax (float) – The values to be passed to the colormap.
- Returns:
The output of ax.imshow.
- Return type:
res
- mobilkit.viz.visualize_boundarymap(boundary)
- mobilkit.viz.visualize_simpleplot(df)