You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Likely related to the observation in prev. Issue #71 regarding warnings.
Attempting to plot with Pandana's built in tool results in a blank graph, like this:
Above image is based off a bounding box bbox = (-89.566399, 42.984056, -89.229584, 43.171917) (note shown arrangement is before bbox is resorted/ordered in function.
The plot function in UrbanAccess's plot.py file was used in my case as a rough guide to generate a temporary replacement function to enable the plot function in Pandana to work.
Should it be of any assistance, I will include it below:
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib import collections as mc
x_min, y_min, x_max, y_max = bbox
bbox_aspect_ratio = (y_max-y_min)/(x_max-x_min)
fig_height = 35
fig, ax = plt.subplots(figsize=(fig_height / bbox_aspect_ratio, fig_height))
x_vals = list(p_net.nodes_df.x.values)
y_vals = list(p_net.nodes_df.y.values)
s = p_net.aggregate(15, type="sum", decay="linear", name="emp")
s = s[s.values == 0]
s[s.values == 0] = 9000
# drop all 0s
data = s[s.values > 0]
num_bins = 10
categories = pd.qcut(x=data, q=num_bins, labels=range(num_bins))
import matplotlib.cm as cm
color_list = [cm.get_cmap('hot')(x) for x in np.linspace(0.1, 0.9, num_bins)]
cleaned_categories = [int(cat) for cat in categories]
colors = [color_list[cat] for cat in cleaned_categories]
ax.scatter(x_vals, y_vals, s=5, c=colors, alpha=0.35, edgecolor='none', zorder=3)
margin=0.02
margin_ns = (y_min-y_max) * margin
margin_ew = (x_min-x_max) * margin
ax.set_ylim((y_min - margin_ns, y_max + margin_ns))
ax.set_xlim((x_min - margin_ew, x_max + margin_ew))
# configure axis
ax.get_xaxis().get_major_formatter().set_useOffset(False)
ax.get_yaxis().get_major_formatter().set_useOffset(False)
ax.axis('off')
plt.savefig('testplot.png', facecolor='black')
The text was updated successfully, but these errors were encountered:
Likely related to the observation in prev. Issue #71 regarding warnings.
Attempting to plot with Pandana's built in tool results in a blank graph, like this:
Above image is based off a bounding box
bbox = (-89.566399, 42.984056, -89.229584, 43.171917)
(note shown arrangement is beforebbox
is resorted/ordered in function.The plot function in UrbanAccess's
plot.py
file was used in my case as a rough guide to generate a temporary replacement function to enable the plot function in Pandana to work.Should it be of any assistance, I will include it below:
The text was updated successfully, but these errors were encountered: