1
$\begingroup$

I really like how this visualization represents the survey participants.

Is any tool for that? (Or R/python library?)

enter image description here

$\endgroup$
1
$\begingroup$

My go to library would be matplotlib, with which it is relatively easy to generate something similar.

I don't have the correct font family to render the exact output as above, but this hopefully illustrates the point
enter image description here

Source Code

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt


# Create the data to plot on
# create a 2d array of evenly-spaced points on a grid
xy_range = np.arange(10.)
data = pd.DataFrame([[x, y] for x in xy_range for y in xy_range], columns=['X', 'Y'])

# color the points
# all green first and then with exceptions
data['color'] = 'green'
data.loc[(data['X']>=0)&(data['Y']==1), 'color'] = 'yellow'
data.loc[(data['X']>=8)&(data['Y']==2), 'color'] = 'yellow'
data.loc[(data['X']>=6)&(data['Y']==0), 'color'] = 'blue'

# We'll use this to calculate axis fractions
max_x = data['X'].max()
max_y = data['Y'].max()

fig, currAX = plt.subplots(figsize=(5,5), facecolor='lightgray')

# plot/mark each point as an annotation
# we do this so we can get a custom emoji instead a marker
for x0, y0, color in zip(data['X'], data['Y'], data['color']):    
    plt.annotate(s=u'\u263B', xy=(x0/max_x, y0/max_y), fontname='STIXGeneral', color=color, size=15, ha='center', va='center')

# clear the axis lables, ticks, and lines        
currAX.get_xaxis().set_visible(False) 
currAX.get_yaxis().set_visible(False)       
plt.axis('off')

plt.show();
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.