2
$\begingroup$

Given the following data set:

Sample data set

I am wondering what kind of plotting technique can be used to produce such a visualization: Desired visualization of the data set

The Skill attribute is mapped to the y-axis, while the Participant is on the x-axis. The other two attributes are encoded as colour and size features of each point in the visualization.

Although I am trying to get this done with Pandas and pdvega, I'd be happy to learn another tool that could render that. But most importantly, I would like to know the proper technical terms used to describe this type of visualization.

I have reviewed various Pandas tutorials, but the problem is that the examples provided are targeting numeric data, rather than categories. I am thinking that perhaps I could partially fake it by turning each category into a number, then somehow overriding the labels on the axis - but it sounds like a convoluted solution to a mundane problem, so there ought to be a nicer way to do it.

Here is the raw data that can be used to produce a Pandas dataframe with the data above:

import pandas as pd
raw = {"Age":{"0":"27..35","1":"18..26","2":"18..26","3":"18..26","4":"18..26"},
       "Skill":{"0":"intermediate","1":"expert","2":"novice","3":"intermediate","4":"expert"},
       "Gender":{"0":"M","1":"M","2":"F","3":"F","4":"M"}}
df = pd.DataFrame(raw)
$\endgroup$
  • $\begingroup$ plotly can easily do this.. $\endgroup$ – Aditya Feb 28 '18 at 10:35
  • $\begingroup$ Can you provide an example? $\endgroup$ – ralien Feb 28 '18 at 10:41
  • $\begingroup$ using Tableau will do these in minutes..pretty sure $\endgroup$ – Aditya Feb 28 '18 at 11:35
  • $\begingroup$ Maybe this would be better posted to StackOverflow, since it's a coding question (I think?) $\endgroup$ – StatsSorceress Feb 28 '18 at 16:36
0
$\begingroup$

The easiest solution I found is Altair:

import altair as alt

# assume df contains the DataFrame from the question + a numeric column `Participant`
alt.Chart(df).mark_point().encode(y='Skill', x='Participant', size='Age', color='Gender')

This is what gets rendered out of the box:

Image generated with default settings

| improve this answer | |
$\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.