问题
I'll working with 49 options (7 rows, 7 columns).
Here is an example
I'm observing what people do (position x actions) in public plazas (total of four) for a school project. I probabily will show it over a large range of time: Each hour from 8AM to 8PM in working days and in weekend days. The main idea is to understand how the plaza is used by people.
I notice the most comon situation is: standing AND talking, sit AND talk, sit AND reading, standing AND recreation. But I found some option like: just sitting, so, only one row (position) without correlation with column (action).
回答1:
If you observe, that people do nothing, then you must take 'do nothing' into your observational list. You could evaluate/display the observational matrix with a heat plot:
Here the code:
import numpy as np
import matplotlib.pylab as plt
nx, ny = 3,5
obs = np.random.randint(10, size=(nx, ny)) # a random observational matrix
activity1 = ['talk', 'listen', 'recreate','commerce','nothing']
activity2 = ['stand','sit', 'lay']
#--- graphics----
fig, ax = plt.subplots()
im = ax.imshow(obs)
ax.set_yticks(np.arange(nx))
ax.set_xticks(np.arange(ny))
ax.set_xticklabels(activity1)
ax.set_yticklabels(activity2)
plt.setp(ax.get_xticklabels(), rotation=45, ha="right", rotation_mode="anchor")
for i in range(nx):
for j in range(ny):
text = ax.text(j, i, obs[i, j],
ha="center", va="center", color="w")
plt.title('Activity matrix of school project',fontweight='bold');
plt.show()
fig.savefig('school_project.png', transparency=True)
来源:https://stackoverflow.com/questions/54947281/diagram-graphical-options-to-display-cartesian-product-in-juniper-notebook-pytho