mirror of
https://github.com/13hannes11/UU_NCML_Project.git
synced 2024-09-03 20:50:59 +02:00
add party plot colors match mp plot
This commit is contained in:
@@ -186,6 +186,7 @@ def plot_mps(names, xs, ys, party_affiliation):
|
|||||||
|
|
||||||
|
|
||||||
def plot_parties(xs, ys, party_affiliation):
|
def plot_parties(xs, ys, party_affiliation):
|
||||||
|
cmap = plt.cm.RdYlGn
|
||||||
# converting parties to numeric format
|
# converting parties to numeric format
|
||||||
party_index_mapping, party_ids = np.unique(party_affiliation, return_inverse=True)
|
party_index_mapping, party_ids = np.unique(party_affiliation, return_inverse=True)
|
||||||
|
|
||||||
@@ -201,7 +202,8 @@ def plot_parties(xs, ys, party_affiliation):
|
|||||||
party_ys /= party_count
|
party_ys /= party_count
|
||||||
|
|
||||||
plt.figure()
|
plt.figure()
|
||||||
plt.scatter(party_xs, party_ys)
|
party_colors=np.array(range(len(party_index_mapping)))
|
||||||
|
plt.scatter(party_xs, party_ys, c=party_colors, cmap=cmap)
|
||||||
# plotting labels
|
# plotting labels
|
||||||
offset = 0.01
|
offset = 0.01
|
||||||
for x,y, party in zip(party_xs, party_ys, party_index_mapping):
|
for x,y, party in zip(party_xs, party_ys, party_index_mapping):
|
||||||
|
|||||||
Reference in New Issue
Block a user