Beeswarm plot in Alteryx

David Sánchez
dsmdaviz
Published in
2 min readNov 14, 2018

Beeswarm — an HTML Tool using Python

Accepting the challenge to build an HTML tool in Alteryx (in my case, with the Python engine), I settled for something I’ve been missing from the reporting tools (even with the added Plotly features):

A simple way to create a swarmplot. I was hoping to be using the PyBeeswarm module, that offered multiple ways of jittering the data, but it seems to not be updated anymore so, instead, created a wrapper for seaborn.swarmplot, which, additionally, allows for an overlay with violin plots or box plots.

The packaged tool is here (.yxi installer) and a sample workflow here.

icon of the Beeswarm tool showing the python icon and a
Beeswarm Tool

Bringing the tool to the canvas, connecting it to the data stream and running the workflow once (so that the tool becomes aware of the fields available upstream) will bring the configuration window with the options to configure.

configuration window - select measures, categorical to split, color, overlays, etc.
Configuration of the BeeSwarm Tool
  • Required items:
  1. At least one numeric measure
  • Optional:
  1. Other measures.
  2. One categorical variable to split the dots.
  3. A column to specify the color.
  4. Settings for the graph (Despine or not — and then trim it or not, Show/Hide Legends).
  5. Select overlay: None, Boxplot, Violinplot.

Swarmplot without color source

When a column with the color information is not provided, colors are assigned randomly.

The current version doesn’t accept a color column when no key is added (it will color the different measures randomly).

https://dsmdaviz.com/wp-content/uploads/2018/11/random_colors.webm

Swarmplot with a color source

Colors are assigned as specified

https://dsmdaviz.com/wp-content/uploads/2018/11/random_colors.webm

Sample Outputs Using Iris dataset. Different overlays with Despine and Trim ON.
workflow where the tool is used with multiple configurations
Sample Workflow with different tool settings.

Thanks for reading!

Twitter Linkedin Medium Rss

Originally published at TABLEAU PASO A PASO.

--

--