PyPlutchik

PyPlutchik is a Python module specifically designed for the visualisation of Plutchik’s wheel of emotions in texts or in corpora. PyPlutchik draws the Plutchik’s flower with each emotion petal sized after how much that emotion is detected or annotated in the corpus, also representing three degrees of intensity for each of them. PyPlutchik allows users to display also primary, secondary, tertiary and opposite dyads.

Documentation

PyPlutchik is a small module with just one function:

It draws the Plutchik's wheel of emotion, with petals sized after the input parameter scores.

Parameters:

Returns:




Walkthrough

Here it follows a gallery of examples, where it is showcased every pyplutchik's parameter. In each section, you will see a snippet of code and the plot it generates.

Basic usage

The simplest way to use pyplutchik is to plot a dict of values in the classic flower-shaped representation:

Emotions can also be detailed in 3 degrees of intensity each:

Simple integration with matplotlib: ax

Subplot composition is responsibility of matplotlib. PyPlutchik can be used for plotting on a matplotlib.axes:

Managing fonts: font, fontweight, fontsize

It is possible to use any font available in your system.

Small-multi: show_coordinates

Ticks can be added in order to mark a visual reference, for an easier understanding of the petal length.

This features comes handy when plotting small-multiples (here we just repeated the same flower over and over... you should change scores every time!)

![](img/documentation/06.png" alt="Small multi" width="700"/>

 

Ticks in polar coordinates: show_ticklabels, ticklabels_angle

Ticks can be added in order to mark a visual reference, for an easier understanding of the petal length. Ticks can be also rotated, if you don't want them to overlap on the Joy petal.

Zoom and focus: highlight_emotions, show_intensity_labels

Controlling what information to display about which emotion can be crucial to tell the right story. Here, with highlight_emotion you can decide to color only a subset of petals; with show_intensity_labels you can decide to show all the three degrees of intensity labels.

Petal proportion: height_width_ratio

Do you like thinner petals? Or do you prefer thicker shapes?

Managing the title: title, title_size

How do we set a title to this plot?

Rescaling petal length: normalize

Unfortunately your emotion scores are very low: the highest score is 0.23! This will make your flower barely visible... unless you scale petal length on a new printable space, let's say from 0 to 0.25!