Semeraro Et Al. 2021 - PyPlutchnik Options To Represent
Semeraro Et Al. 2021 - PyPlutchnik Options To Represent
Semeraro Et Al. 2021 - PyPlutchnik Options To Represent
RESEARCH ARTICLE
* alfonso.semeraro@unito.it
a1111111111 Abstract
a1111111111
a1111111111 The increasing availability of textual corpora and data fetched from social networks is fuel-
a1111111111 ling a huge production of works based on the model proposed by psychologist Robert Plu-
a1111111111 tchik, often referred simply as the “Plutchik Wheel”. Related researches range from
annotation tasks description to emotions detection tools. Visualisation of such emotions is
traditionally carried out using the most popular layouts, as bar plots or tables, which are how-
ever sub-optimal. The classic representation of the Plutchik’s wheel follows the principles of
OPEN ACCESS proximity and opposition between pairs of emotions: spatial proximity in this model is also a
Citation: Semeraro A, Vilella S, Ruffo G (2021) semantic proximity, as adjacent emotions elicit a complex emotion (a primary dyad) when
PyPlutchik: Visualising and comparing emotion- triggered together; spatial opposition is a semantic opposition as well, as positive emotions
annotated corpora. PLoS ONE 16(9): e0256503.
are opposite to negative emotions. The most common layouts fail to preserve both features,
https://doi.org/10.1371/journal.pone.0256503
not to mention the need of visually allowing comparisons between different corpora in a
Editor: Christopher M. Danforth, University of
blink of an eye, that is hard with basic design solutions. We introduce PyPlutchik the
Vermont, UNITED STATES
Pyplutchik package is available as a Github repository (http://github.com/alfonsosemeraro/
Received: June 8, 2021
pyplutchik) or through the installation commands pip or conda. For any enquiry about usage
Accepted: August 6, 2021 or installation feel free to contact the corresponding author, a Python module specifically
Published: September 1, 2021 designed for the visualisation of Plutchik’s emotions in texts or in corpora. PyPlutchik draws
Peer Review History: PLOS recognizes the the Plutchik’s flower with each emotion petal sized after how much that emotion is detected
benefits of transparency in the peer review or annotated in the corpus, also representing three degrees of intensity for each of them.
process; therefore, we enable the publication of Notably, PyPlutchik allows users to display also primary, secondary, tertiary and opposite
all of the content of peer review and author
dyads in a compact, intuitive way. We substantiate our claim that PyPlutchik outperforms
responses alongside final, published articles. The
editorial history of this article is available here: other classic visualisations when displaying Plutchik emotions and we showcase a few
https://doi.org/10.1371/journal.pone.0256503 examples that display our module’s most compelling features.
Copyright: © 2021 Semeraro et al. This is an open
access article distributed under the terms of the
Creative Commons Attribution License, which
permits unrestricted use, distribution, and
reproduction in any medium, provided the original
author and source are credited. 1 Introduction
Data Availability Statement: All data is freely The recent availability of massive textual corpora has enhanced an extensive research over the
available and the plots can be easily reproduced,
emotional dimension underlying human-produced texts. Sentences, conversations, posts,
we do not have any special access to the data. The
data is properly referenced in the bibliography, the
tweets and many other pieces of text can be labelled according to a variety of schemes, that
links are the following: SSEC data: http://www. refer to as many psychological theoretical frameworks. Such frameworks are commonly
romanklinger.de/ssec/ Amazon data: https:// divided into categorical models [1–4], based on a finite set of labels, and dimensional models
jmcauley.ucsd.edu/data/amazon/ IMDB data: [5, 6], that position data points as continuous values in an N-dimensional vector space of emo-
https://www.kaggle.com/omarhanyy/imdb-top- tions. One of the most famous dimensional models is Russel’s circumplex model of emotions
1000 We added the scripts to reproduce the plots
[7]. Russel’s model posits that affect states are defined by dimensions that are not independent:
to the Github repository.(https://github.com/
alfonsosemeraro/pyplutchik). emotions can be represented as points in a space whose main orthogonal axes represent their
degree of arousal and of pleasure/displeasure. According to Russel, the full spectrum of emo-
Funding: The author(s) received no specific
tions can be meaningfully placed along the resulting circumference. Russel is not the first
funding for this work.
scholar to use a circular layout to represent emotions (for instance, it was already used in [8]):
Competing interests: The authors have declared indeed, this kind of circumplex representation became very popular over time, since it is suit-
that no competing interests exist.
able to spatially represent emotions on a continuous space.
The cultural variation of emotions has also been studied. This is a crucial factor to take into
account when classifying emotions: intuitively, the categories themselves can radically change
depending on the cultural background [9]. This is also valid with respect to how the annotator
perceives the emotions in a text and, if the annotated data is then used to train a classifier, it
can introduce a bias in the model. The nomenclature of emotions, their meanings and the rela-
tions of words to emotion concepts depend on the social frameworks in which we are born
and raised: therefore, cultural variation can significantly impact this kind of analysis. In this
regard, in [10] the authors estimate emotion semantics across a sample of almost 2500 spoken
languages, finding high variability in the meaning of emotion terms, but also evidence of a uni-
versal structure in the categorization of emotions. Following different methodological
approaches, similar results were previously obtained in [11].
Regardless of their categorical or dimensional nature, the emotional models provide a com-
plex and multifaceted characterisation of emotions, which often necessitates dedicated and
innovative ways to visualise them. This is the case of Plutchik’s model of emotions [12], a cate-
gorical model based on 8 labels (Joy, Trust, Fear, Surprise, Sadness, Disgust, Anger and Antici-
pation). According to the model, emotions are displayed in a flower-shaped representation,
famously known as Plutchik’s wheel, which has become since then a classic reference in this
domain. The model, that displays emotions in this circumplex-like representation and that is
described in detail in Sec. 2, leverages the disposition of the petals around the wheel to high-
light the similar (or opposite) flavour of the emotions, as well as how similar emotions, placed
in the same “hemisphere” of the wheel, can combine into primary, secondary and tertiary
dyads, depending on how many petals away they are located on the flower.
It is clear that such a complex and elaborated solution plays a central role in defining the
model itself. Still, as detailed in Sec. 2, many studies that resort to Plutchik’s model display
their results using standard data visualisation layouts, such as bar plots, tables, pie charts and
scatter plots, most likely due to the lack of an easy, plug-and-play implementation of the Plu-
tchik’s wheel.
On these premises, we argue that the most common layouts fail to preserve the characteris-
ing features of Plutchik’s model, not to mention the need of visually allowing comparisons
between different corpora at a glance, that is hard with basic design solutions. We contribute
to fill the gap in the data visualisation tools by introducing PyPlucthik, a Python module for
visualising texts and corpora annotated according to the Plutchik’s model of emotions. Given
the preeminence of Python as a programming language in the field of data science and, partic-
ularly, in the area of Natural Language Processing (NLP), we believe that the scientific commu-
nity will benefit from a ready-to-use Python tool to fulfil this particular need. Of course, other
packages and libraries may be released for other languages in the future.
PyPlutchik provides an off-the-shelf Python implementation of the Plutchik’s wheel. Each
petal of the flower is sized after the amount of the correspondent emotion in the corpus: the
more traces of an emotion are detected in a corpus, the bigger the petal is drawn. Along with
Table 1. Plutchik’s 8 basic emotions with 3 degrees of intensity each. Emotions are commonly referred as the middle
intensity degree ones.
Lower intensity Emotion Higher intensity
Annoyance Anger Rage
Interest Anticipation Vigilance
Serenity Joy Ecstasy
Acceptance Trust Admiration
Apprehension Fear Terror
Distraction Surprise Amazement
Pensiveness Sadness Grief
Boredom Disgust Loathing
https://doi.org/10.1371/journal.pone.0256503.t001
the 8 basic emotions, PyPlutchik displays also three degrees of intensity for each emotion (see
Table 1).
PyPlutchik is built on top of Python data visualisation library matplotlib [13], and it is fully
scriptable, hence it can be used for representing the emotion annotation of single texts (e.g. for
a single tweet), as well as of entire corpora (e.g. a collection of tweets), offering a tool for a
proper representation of such annotated texts, which at the best of our knowledge was missing.
The two-dimensional Plutchik’s wheel is immediately recognisable, but it is a mere qualitative
illustration. PyPlutchik introduces a quantitative dimension to this representation, making it a
tool suitable for representing how much an emotion is detected in a corpus. The module
accepts as an input a score si 2 [0, 1] for each of the 24 i emotions in the model (8 basics emo-
tions, 3 degrees of intensity each). Please note that, since the same text cannot express two dif-
ferent degrees of the same emotion, the sum of all the scores of the emotions belonging to the
same branch must be less than or equal to 1. Each emotion petal is then sized according to this
score. In Fig 1 we can see an example of the versatility of the PyPlutchik representation of the
annotated emotions: in (i) we see a pseudo-text in which only Joy, Trust and Sadness have been
detected; in (ii) for each emotion, the percentage of pseudo-texts in a pseudo-corpus that show
that emotion; finally (iii) contains a detail of (ii), where the three degrees of intensity have
been annotated separately.
Most importantly, PyPlutchik is respectful of the original spatial and aesthetic features of
the wheel of emotions intended by its author. The colour code has been hard-coded in the
Fig 1. A three fold showcase of our visualisation tool on synthetic data: (i) a text where only Joy, Trust and Sadness have been
detected; (ii) a corpus of many texts. Each petal is sized after the amount of items in the corpus that show that emotion in; (iii) same
corpus as (ii), but higher and lower degrees of intensity of each emotion are expressed.
https://doi.org/10.1371/journal.pone.0256503.g001
module, as it is a distinctive feature of the wheel that belongs to collective imagination. Spatial
distribution of the emotion is also a standard, non customisable feature, as the displacement of
each petal of the flower is non arbitrary, because it reflects a semantic proximity of close emo-
tions, and a semantic contrariety of opposite emotions (see Sec. 2).
Representing emotions detected in texts can be hard without a proper tool, but it is a need
for the many scientists that work on text and emotions. A great variety of newly available digi-
tal text has been explored in order to uncover emotional patterns; the necessity of a handy
instrument to easily display such information is still unsatisfied.
In the following sections, after introducing the reader to the topic of emotion models and
their applications in corpora annotation, we will focus on the Plutchik’s emotion model and
the current state of the art of its representations. A detailed technical explanation of the
PyPlutchik module will follow, with several use cases on a wide range of datasets to help sub-
stantiating our claim that PyPlutchik outperforms other classic visualisations.
2 Related work
2.1 Visualising textual data
Visualising quantitative information associated to textual data might not be an easy task, due
to “the categorical nature of text and its high dimensionality, that makes it very challenging to
display graphically” [14]. Several scientific areas leverage visualisations techniques to extract
meaning from texts, such as digital humanities [15] or social media analysis [16].
Textual data visualisations often usually provide tools for literacy and citation analysis; e.g.,
PhraseNet [17], Word Tree [18], Web Seer http://hint.fm/seer/, and Themail [19] introduced
many different ways to generate visual overviews of unstructured texts. Many of these projects
were connected to ManyEyes, that was launched in 2007 by Viégas, Wattenberg, and al. [20] at
IBM, and closed in 2015 to be included in IBM Analytics. ManyEyes was designed as a web
based community where users (mainly data analysts and visualisation designers) could upload
their data to establish conversations with other users. The ambitious goal was to create a social
style of data analysis so that visualisations can be tools to create collaboration and carry on
discussions.
Nevertheless, all of these classic visualisation tools did not allow the exploration of more
advanced textual semantic features that can be analysed nowadays due to the numerous devel-
opments of Natural Language Processing techniques; nowadays, it exists a good number of
software suites—such as Tableau, Microsoft PowerBI or Datawrapper, just to mention a few—
that give the users a chance to create very interesting, eye-catching and often complex visuali-
zations. They all adopt a graphical user interface, with all the pros and cons that usually come
with it: an intuitive and fast way to realise the majority of the most common layouts, but likely
less flexible when it comes to create a more personalised visualisation. On the other hand, pro-
gramming libraries and modules—such as Python’s Matplotlib [13], Plotly [21] and Bokeh
[22], or D3.js [23] in Javascript allow the users to create freely their own visualisations, though
with a much steeper learning curve for those who are not familiar with these technologies.
The recent advancements in text technologies have enabled researchers and professional
analysts with new tools to find more complex patterns in textual data. Algorithms for topic
detection, sentiment analysis, stance detection and emotion detection allow us to convert very
large amounts of textual data to actionable knowledge; still, the outputs of such algorithms can
be too hard to consume if not with an appropriate data visualisation [24]. During the last
decade, many works have been carried out to fill this gap in the areas of (hierarchical) topic
visualisation [25–28], sentiment visualisation (a comprehensive survey can be found in [29]),
online hate speech detection [30], stance detection [31] and many more.
Our work lies within the domain of visualisation of emotions in texts, as we propose a novel
Python implementation of Plutchik’s wheel of emotions.
Fig 2. Plutchik’s wheel of emotions. Each petal is partitioned in three degrees of intensity, from the most intense (the
most internal section) to the least intense (the most external section).
https://doi.org/10.1371/journal.pone.0256503.g002
elements in a polar coordinate system, close to the original Plutchik’s one. Windrose diagrams
combine both advantages, displaying categorical data on a polar coordinate system. PyPlutchik
is inspired to this representation, and it adapts this idea to the collective imagination of Plu-
tchik’s wheel of emotion graphical picture.
Fig 3. Diagram of Plutchik’s dyads. When two emotions are elicited together, they trigger the corresponding primary
dyad if they are just one petal apart, a secondary dyad if they are two petal distant each other, a tertiary dyad if they are
three petal distant, an opposite dyad if they are on the opposite side of the flower.
https://doi.org/10.1371/journal.pone.0256503.g003
which is not represented in a bar plot. PyPlutchik preserves both semantic opposition and
semantic proximity: the mass distribution of the ink in Fig 14(i and vi), for instance, imme-
diately communicates of a positive corpus, as positive emotions are way more expressed
than their opposites.
• Pie charts, as used in [55, 64–67]. Pie charts are a better approximation of the Plutchik’s
wheel, as they respect the colour code and they almost respect the spatial displacement of
emotions. However, the actual displacement may depend on the emotion distribution: with
a skewed distribution toward one or two emotions, all the remaining sectors may be shrunk
and translated to a different position. Pie charts do not guarantee a correct spatial position-
ing of each category. There is also an underlying conceptual flaw in pie charts: they do not
handle well items annotated with more than one tag, in this case texts annotated with more
than one emotion. In a pie chart, the sum of the sectors’ sizes must equal the number of all
the items; each sector would count how many items fall into a category. If multiple annota-
tion on the same item are allowed, the overall sum of sectors’ sizes will exceed the number of
actual items in the corpus. Null-annotated items, i.e. those without a noticeable emotion
within, must be represented as a ninth, neutral sector. PyPlutchik handles multi-annotated
and null-annotated items: for instance, Fig 1(ii) shows a pseudo-corpus where Anger and
Disgust both are valued one, because they appear in 100% of the pseudo-texts within. Fig 1(i)
shows a text with several emotions missing.
• Heatmaps, as used in [68, 69]. Both papers coded the intensity of the 8 basic emotions
depending on a second variable, respectively time and principal components of a vectorial
representation of texts. Although heatmaps naturally fit the idea of an intensity score at the
crossroad of two variables, the final display are sub-optimal in both cases, because they fail to
preserve both the Plutchik’s wheel’s colour code and spatial displacement of emotions. As
described in Sect. 3, PyPlutchik can be easily scripted for reproducing small-multiples. In
Fig 4. Plutchik’s wheel generated by code on the right. Each entry in the Python dict is a numeric value 2 [0, 1].
https://doi.org/10.1371/journal.pone.0256503.g004
representation. PyPlutchik can be used either to plot only the 8 basic emotions, or to show the
full intensity spectrum of each emotion, assigning three scores for the three intensity levels. In
the latter case, each petal is divided into three sections, with colour intensity decreasing from
the centre. In both cases PyPlutchik accepts as input a dict data structure, with exactly 8 items.
Keys must be the 8 basic emotions names. dict is a natural Python data structure for represent-
ing JSON files, making PyPlutchik an easy choice to display JSONs. In case of basic emotions
only, values in the dict must be numeric 2 [0, 1], while in case of intensity degrees they must
be presented as an iterable of length three, whose entries must sum to maximum 1. Figs 4
and 5 show how straightforward it is to plug a dict into the module to obtain the visualisation.
Furthermore, PyPlutchik can be used to display the occurrences of primary, secondary, and
tertiary dyads in our corpora. This more advanced feature will be described in Sect. 4.
Due to the easy integration with Python basic data structures and the matplotlib library,
PyPlutchik is also completely scriptable to display several plots side by side as small-multiple.
Default font family is sans-serif, and text is printed with light weight and size 15 by default.
However, it is possible to modify these features by the means of the corresponding parameters
(see the documentation the Pyplutchik documentation is available in the Github repository at
https://github.com/alfonsosemeraro/pyplutchik/blob/master/Documentation.md for a com-
prehensive and always up-to-date explanation of parameters and features of the module).
These features can be also changed with standard matplotlib syntax. The polar coordinates
beneath petals and the labels outside can be hidden: this feature leaves only the flower on
screen, improving visibility of small flowers in small-multiple plots. Also the petals aspect can
be modified, by making them thinner or thicker. Fig 6 shows a small-multiple, with hidden
Fig 5. Plutchik’s wheel generated by code on the right. Each entry in the Python dict is a three-sized array, whose
sum must be 2 [0, 1].
https://doi.org/10.1371/journal.pone.0256503.g005
Fig 6. Small-multiple of a series of Plutchik’s wheel built from synthetic data. Polar coordinates beneath the flowers and
labels around have been hidden to improve the immediate readability of the flowers, resulting in a collection of emotional
fingerprints of different corpora.
https://doi.org/10.1371/journal.pone.0256503.g006
polar coordinates and labels, computed on synthetic random data that have been artificially
created only for illustrative purposes. Code for this kind of representation is in the code docu-
mentation, as well as a short overview on the parameters that make possible to reproduce the
aforementioned variations.
As a further customisation option, we allow the user to select a set of petals to be
highlighted. This selective presentation feature follows a focus-plus-context [76] approach to
the need of emphasising those emotions that might be more distinctive, according to the case
under consideration. We chose to apply a focus-plus-context visualisation by filling petals’
areas selectively, without adopting other common techniques, as with fish-eye views [77], in
order to avoid distortions and to preserve the spatial relations between the petals. It is possible
to select a list of main emotions, and to show a colored petal and all three intensity scores for
each emotion in the list, while for the others it will display a grey petal and the cumulative
scores only, also in grey. We showcase this feature in Fig 7 and in the code documentation.
Fig 7. A side-by-side comparison between the synthetic plot of Fig 1(iii) and an almost identical wheel, but with only two emotions highlighted.
We highlighted and displayed the three intensity scores of Anticipation and Joy.
https://doi.org/10.1371/journal.pone.0256503.g007
Fig 8. Primary dyads’ wheel generated by code on the right. Each entry in the Python dict is a numeric value 2 [0, 1].
https://doi.org/10.1371/journal.pone.0256503.g008
This last feature is particularly useful to give the user an immediate sense of the primary
emotions involved in the formation of the dyad. Fig 8 provides an example of the wheel pro-
duced if the user inputs a dict containing primary dyads instead of emotions. PyPlutchik auto-
matically checks for the kind of input wheel and for its coherence: specifically, the module
retrieves an error if the input dictionary contains a mix of emotions from different kind of
dyads, as they cannot be displayed on the same plot. In Fig 9 we show a representation of basic
emotions, primary dyads, secondary dyads, tertiary dyads and opposite dyads, based on syn-
thetic data. This representation easily conveys the full spectrum of emotions and their combi-
nations according to Plutchik’s model, allowing for a quick but in-depth analysis of emotions
detected in a corpus.
5 Case studies
We now showcase some useful examples of data visualisation using PyPlutchik. We argue that
PyPlutchik is more suitable than any other graphical tool to narrate the stories of these exam-
ples, because it is the natural conversion of the original qualitative model to a quantitative
akin, tailored to visually represent occurrences of emotions and dyads in an annotated corpus.
Fig 9. Representation of emotions and primary, secondary, tertiary and opposite dyads. The data displayed is
random.
https://doi.org/10.1371/journal.pone.0256503.g009
Fig 10. Average emotion scores in a sample of textual reviews of office products on Amazon. Rating of products goes from one star (worst) to five
(best). On the left, emotions detected in negative reviews (one star), on the right the emotions detected in positive reviews (five star). While positive
emotions stay roughly the same, negative emotions such Anger, Disgust and Fear substantially drop as the ratings get higher.
https://doi.org/10.1371/journal.pone.0256503.g010
desired emotions without losing sight of the others, that are left untouched in their size or
shape but are overshadowed, deprived of their coloured fill.
Fig 11. Focus-plus-context: The selective presentation feature of PyPlutchik allows to put emphasis on some particular emotions, without losing
sight of the others; we can compare different subgroups of the same Amazon corpus placing our visualisations side-by-side, and highlighting only
Anger, Disgust and Fear petals, to easily spot how these negative emotions are under represented in 5-stars reviews than in 1-star reviews.
https://doi.org/10.1371/journal.pone.0256503.g011
emotions. Thrillers and Action movies share a similar emotion distribution, while Music and
Musical classify for the happiest.
Fig 12. Emotions in the synopses of the top 1000 movies in the IMDB database, divided by four genres. The shapes are immediately distinct from
each other, and they return an intuitive graphical representation of each genre’s peculiarities.
https://doi.org/10.1371/journal.pone.0256503.g012
principal candidates. Data is the training set released for a SemEval 2016 task, namely a corpus
of annotated stances, sentiments and emotions in tweets [82]. Each candidate is represented in
both plots on a different row, and each row displays five subplots, respectively basic emotions,
primary dyads, secondary dyads, tertiary dyads and opposite dyads. Tweets supporting either
Trump or Clinton present higher amounts of positive emotions (Fig 14(i) and 14(vi)), namely
Fig 13. Emotions in the synopses of the 20 most common movie genres in the IMDB database. Coordinates, grids and labels are not visible: this is
an overall view of the corpus, meant to showcase general trends and to spot outliers that can be analysed at a later stage, in dedicated plot.
https://doi.org/10.1371/journal.pone.0256503.g013
Anticipation, Joy and Trust, and from lower to no amounts of negative emotions, especially
Sadness and Disgust. On the contrary, tweets critical of each candidate (Fig 15(i) and 15(vi))
show high values of Anger, coupled with Disgust, probably in the form of disapproval.
There are also significant differences between the two candidates. Donald Trump collects
higher levels of Trust and Anticipation from his supporters than Hillary Clinton, possibly
meaning higher expectations from his electoral base. Users that are skeptical of Hillary Clinton
show more Disgust towards her than Donald Trump’s opponents towards him.
Besides basic emotions, PyPlutchik can display the distribution of dyads as well, as
described in Sec. 4. Dyads allow for a deeper understanding of the data. We can see how the
tweets against the presidential candidates in Fig 15 are dominated by the negative basic emo-
tion of Anger, with an important presence of Disgust and Anticipation (subplots (i) and (vi));
the dominant primary dyad is therefore the co-occurence of Anger and Disgust (subplot (ii)),
i.e. the primary dyad Contempt, but not Aggressiveness, the primary dyad formed by Anger and
Anticipation: the latter rarely co-occurs with the other two, which means that expectations and
Fig 14. Tweets in favour of Donald Trump and Hillary Clinton from the 2016 StanceDetection task in SemEval. From left to right: basic emotions,
primary dyads, secondary dyads, tertiary dyads and opposite dyads for both candidates (Donald Trump on the first row, Hillary Clinton on the second
one). Despite the high amounts of Anticipation, Joy and Trust for both the candidates, which result in similar primary dyads, there is a significant spike
on the secondary dyad Hope among Trump’s supporters that is not present in Clinton’s supporters.
https://doi.org/10.1371/journal.pone.0256503.g014
contempt are two independent drives in such tweets. The other dyads are relatively scarcer as
we progress on the secondary and tertiary level (subplots (iii)-(v)). The supporting tweets in
Fig 14 are characterised by positive emotions, both in the primary flower and in the dyads,
with these again being a reflection of the co-occurrence of the most popular primary emotions.
Although Anticipation, Joy and Trust are present in different amounts, primary dyads Opti-
mism and Love do occur in a comparable number of cases (subplot (ii)). Interestingly, the pro-
Trump tweets show a remarkable quantity of Hope, the secondary dyad that combines
Fig 15. Similarly to Fig 14, here are shown the emotions captured in the tweets against Donald Trump and Hillary Clinton from the 2016
StanceDetection task in SemEval. We see a clear prevalence of negative emotions, particularly Anger and Disgust. This combination is often expressed
together, as can be seen from the primary emotions plots (ii and vii), where there is a spike in Contempt.
https://doi.org/10.1371/journal.pone.0256503.g015
Anticipation and Trust, suggesting that Trump’s supporters expressed towards him all the
three dominant basic emotions together more often that Clinton’s supporters did.
Generally speaking, we notice that there are not many dyads expressed in the tweets. We
can ascribe this to many factors: first and foremost, a dataset annotated only on primary emo-
tions and not also explicitly on the dyads will naturally show less dyads, since their presence
will depend only on the casual co-occurrence of primary emotions. For this reason we resized
the petal lengths in Fig 14(ii)–14(v) and 14(vii)–14(x) with a different scale than (i) and (v),
and the same applies for Fig 15. For instance, Trust petal in Fig 14(i) is almost to the maximum
length, with a score equal to 0.63; Hope petal in (iii) is also almost at the maximum length, but
with a score equal to 0.37. Both figures are therefore designed for a visual comparison of the
petals within the same subplot, but not between two different subplots, due to the lack of con-
sistency in the scale. However, this does not concern us, since our current purpose is to show-
case the potential of PyPlutchik: with this regard, we note that we were immediately able to
track the unexpected presence of the secondary dyad Hope, that stood out among the others.
6 Conclusion
The increasing production of studies that explore the emotion patterns of human-produced
texts often requires dedicated data visualisation techniques. This is particularly true for those
studies that label emotions according to a model such as Plutchik’s one, which is heavily based
on the principles of semantic proximity and opposition between pairs of emotions. Indeed, the
so-called Plutchik’s wheel is inherent to the definition of the model itself, as it provides the per-
fect visual metaphor that best explains this theoretical framework.
Nonetheless, by checking the most recent literature it appears evident that too often this
aspect is neglected, instead entrusting the visual representation of the results to standard, sub-
optimal solutions such as bar charts, tables, pie charts. We believe that this choice does not do
justice neither to the said studies, nor to Plutchik’s model itself, and it is mainly due to the lack
of an easy, plug-and-play tool to create adequate visuals.
With this in mind we introduced PyPlutchik, a Python module for the correct visualisation
of Plutchik’s emotion traces in texts and corpora. PyPlutchik fills the gap of a suitable tool spe-
cifically designed for representing Plutchik’s model of emotions. Most importantly, it goes
beyond the mere qualitative display of the Plutchik’s wheel, that lacks a quantitative dimen-
sion, allowing the user to display also the quantities related to the emotions detected in the text
or in the corpora. Moreover, PyPlutchik goes the extra mile by implementing a new way of
visualising primary, secondary, tertiary and opposite dyads, whose presence is a distinctive
and essential feature of the Plutchik’s model of emotions.
This module is built on top of the popular Python library matplotlib, its APIs being written
in a matplotlib style. PyPlutchik is designed for an easy plug and play of JSON files, and it is
entirely scriptable. It is designed for single plots, pair-wise and group-wise side-by-side com-
parisons, and small-multiples representations. The original Plutchik’s wheel of emotions dis-
place the 8 basic emotions according to proximity and opposition principles; the same
principles are respected in PyPlutchik layout.
It should be noted that the PyPlutchik module is meant to work only with data that was
classified—manually or automatically—according to the Plutchik’s model of emotions. In gen-
eral, it is never advisable to represent data on a different scheme from the one used for its clas-
sification. Most of the models are radically different from each other, both in the underlying
assumptions as well as in the categories scheme; even when they are somewhat similar, there
might be key differences that should be kept into account. As for the Plutchik model in partic-
ular, to the best of our knowledge it does not exist a one-to-one correspondence with any
Author Contributions
Conceptualization: Alfonso Semeraro, Salvatore Vilella, Giancarlo Ruffo.
Data curation: Alfonso Semeraro, Salvatore Vilella.
Formal analysis: Alfonso Semeraro.
Methodology: Alfonso Semeraro, Salvatore Vilella, Giancarlo Ruffo.
Project administration: Giancarlo Ruffo.
Software: Alfonso Semeraro.
Supervision: Giancarlo Ruffo.
Validation: Alfonso Semeraro, Salvatore Vilella.
Visualization: Alfonso Semeraro, Salvatore Vilella, Giancarlo Ruffo.
Writing – original draft: Alfonso Semeraro.
Writing – review & editing: Salvatore Vilella, Giancarlo Ruffo.
References
1. Ekman P. An argument for basic emotions. Cognition & emotion, 6(3-4):169–200, 1992. https://doi.org/
10.1080/02699939208411068
2. James W. The principles of psychology, vol. 1. Cosimo, Inc., 2007.
3. Izard C. E., Libero D. Z., Putnam P., and Haynes O. M. Stability of emotion experiences and their rela-
tions to traits of personality. Journal of personality and social psychology, 64(5):847, 1993. https://doi.
org/10.1037/0022-3514.64.5.847 PMID: 8505713
4. Lazarus R. S. and Lazarus B. N. Passion and reason: Making sense of our emotions. Oxford University
Press, USA, 1994.
5. Watson D. and Tellegen A. Toward a consensual structure of mood. Psychological bulletin, 98(2):219,
1985. https://doi.org/10.1037/0033-2909.98.2.219 PMID: 3901060
6. Mehrabian A. Basic dimensions for a general psychological theory: Implications for personality, social,
environmental, and developmental studies, vol. 2. Oelgeschlager, Gunn & Hain Cambridge, MA,
1980.
7. Russell J. A. A circumplex model of affect. Journal of personality and social psychology, 39(6):1161,
1980. https://doi.org/10.1037/h0077714
8. Schlosberg H. The description of facial expressions in terms of two dimensions. Journal of experimental
psychology. 1952; 44(4):229. https://doi.org/10.1037/h0055778 PMID: 13000062
9. Mohammad SM. Practical and ethical considerations in the effective use of emotion and sentiment lexi-
cons. arXiv preprint arXiv:201103492. 2020.
10. Jackson JC, Watts J, Henry TR, List JM, Forkel R, Mucha PJ, et al. Emotion semantics show both cul-
tural variation and universal structure. Science. 2019; 366(6472):1517–1522. https://doi.org/10.1126/
science.aaw8160 PMID: 31857485
11. Scherer KR, Wallbott HG. Evidence for universality and cultural variation of differential emotion
response patterning. Journal of personality and social psychology. 1994; 66(2):310. https://doi.org/10.
1037/0022-3514.66.2.310 PMID: 8195988
12. Plutchik R. The nature of emotions: Human emotions have deep evolutionary roots, a fact that may
explain their complexity and provide tools for clinical practice. American scientist, 89(4):344–350,
2001.
13. Hunter J. D. Matplotlib: A 2d graphics environment. Computing in Science & Engineering, 9(3):90–95,
2007. https://doi.org/10.1109/MCSE.2007.55
14. Meirelles I. Design for information: an introduction to the histories, theories, and best practices behind
effective information visualizations. Rockport publishers, 2013.
15. Bradley A. J., El-Assady M., Coles K., Alexander E., Chen M., Collins C., et al. Visualization and the dig-
ital humanities. IEEE computer graphics and applications, 38(6):26–38, 2018. https://doi.org/10.1109/
MCG.2018.2878900 PMID: 30668453
16. Wu Y., Cao N., Gotz D., Tan Y.-P., and Keim D. A. A survey on visual analytics of social media data.
IEEE Transactions on Multimedia, 18(11):2135–2148, 2016. https://doi.org/10.1109/TMM.2016.
2614220
17. van Ham F., Wattenberg M., and Viégas F. B. Mapping text with phrase nets. IEEE Trans. Vis. Comput.
Graph., 15(6):1169–1176, 2009. https://doi.org/10.1109/TVCG.2009.165 PMID: 19834186
18. Wattenberg M. and Viégas F. B. The word tree, an interactive visual concordance. IEEE Transactions
on Visualization and Computer Graphics, 14(6):1221–1228, Nov. 2008. https://doi.org/10.1109/TVCG.
2008.172 PMID: 18988967
19. F. B. Viégas, S. Golder, and J. Donath. Visualizing email content: Portraying relationships from conver-
sational histories. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems,
CHI’06, pp. 979–988. ACM, New York, NY, USA, 2006. https://doi.org/10.1145/1124772.1124919
20. Viegas F. B., Wattenberg M., van Ham F. Kriss J., and McKeon M. ManyEyes: A site for visualization at
internet scale. IEEE Transactions on Visualization and Computer Graphics, 13(6):1121–1128, Nov.
2007. https://doi.org/10.1109/TVCG.2007.70577 PMID: 17968055
21. Inc PT. Collaborative data science; 2015. Available from: https://plot.ly.
22. Bokeh Development Team. Bokeh: Python library for interactive visualization; 2014. Available from:
http://www.bokeh.pydata.org.
23. Bostock M, Ogievetsky V, Heer J. D3 data-driven documents. IEEE transactions on visualization and
computer graphics. 2011; 17(12):2301–2309. https://doi.org/10.1109/TVCG.2011.185 PMID:
22034350
24. Dou W. and Liu S. Topic-and time-oriented visual text analysis. IEEE computer graphics and applica-
tions, 36(4):8–13, 2016. https://doi.org/10.1109/MCG.2016.73 PMID: 27514029
25. Cui W., Liu S., Wu Z., and Wei H. How hierarchical topics evolve in large text corpora. IEEE transactions
on visualization and computer graphics, 20(12):2281–2290, 2014. https://doi.org/10.1109/TVCG.2014.
2346433 PMID: 26356942
26. Liu S., Zhou M. X., Pan S., Song Y., Qian W., Cai W., et al. Tiara: Interactive, topic-based visual text
summarization and analysis. ACM Transactions on Intelligent Systems and Technology (TIST), 3(2):1–
28, 2012. https://doi.org/10.1145/2089094.2089101
27. Liu S., Yin J., Wang X., Cui W., Cao K., and Pei J. Online visual analytics of text streams. IEEE transac-
tions on visualization and computer graphics, 22(11):2451–2466, 2015. https://doi.org/10.1109/TVCG.
2015.2509990 PMID: 26701787
28. Cui W., Liu S., Tan L., Shi C., Song Y., Gao Z., et al. Textflow: Towards better understanding of evolving
topics in text. IEEE transactions on visualization and computer graphics, 17(12):2412–2421, 2011.
https://doi.org/10.1109/TVCG.2011.239 PMID: 22034362
29. Kucher K., Paradis C., and Kerren A. The state of the art in sentiment visualization. In Computer Graph-
ics Forum, vol. 37, pp. 71–96. Wiley Online Library, 2018.
30. A. T. Capozzi, V. Patti, G. Ruffo, and C. Bosco. A data viz platform as a support to study, analyze and
understand the hate speech phenomenon. In Proceedings of the 2nd International Conference on Web
Studies, pp. 28–35, 2018.
31. J. Chamberlain, U. Kruschwitz, and O. Hoeber. Scalable visualisation of sentiment and stance. In Pro-
ceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC
2018), 2018.
32. K. Roberts, M. Roach, J. Johnson, J. Guthrie, and S. Harabagiu. Empatweet: Annotating and detecting
emotions on Twitter. Proc. Language Resources and Evaluation Conf, 01 2012.
33. W. Wang, L. Chen, K. Thirunarayan, and A. P. Sheth. Harnessing Twitter “big data” for automatic emo-
tion identification. In 2012 International Conference on Privacy, SeCurity, Risk and Trust and 2012 Inter-
national Conference on Social Computing, pp. 587–592, 2012. https://doi.org/10.1109/SocialCom-
PASSAT.2012.119
34. CBalabantaray R., mohd M., and Sharma N. Multi-class Twitter emotion classification: A new approach.
International Journal of Applied Information Systems, 4:48–53, 09 2012. https://doi.org/10.5120/
ijais12-450651
35. M. Stella, M. S. Vitevitch, and F. Botta. Cognitive networks identify the content of english and Italian
popular posts about covid-19 vaccines: Anticipation, logistics, conspiracy and loss of trust, 2021.
36. D. Preoţiuc-Pietro, H. Schwartz, G. Park, J. Eichstaedt, M. Kern, L. Ungar, et al. Modelling valence and
arousal in Facebook posts. pp. 9–15, 01 2016. https://doi.org/10.18653/v1/W16-0404
37. M. Burke and M. Develin. Once more with feeling: Supportive responses to social sharing on Facebook.
In Proceedings of the 19th ACM Conference on Computer-Supported Cooperative Work & Social Com-
puting, CSCW’16, p. 1462–1474. Association for Computing Machinery, New York, NY, USA, 2016.
https://doi.org/10.1145/2818048.2835199
38. F. Rangel, D. I. H. Farı́as, P. Rosso, and A. Reyes. Emotions and irony per gender in Facebook. 2014.
39. E. Kim and R. Klinger. Who feels what and why? annotation of a literature corpus with semantic roles of
emotions. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 1345–
1359. Association for Computational Linguistics, Santa Fe, New Mexico, USA, Aug. 2018.
40. V. Lombardo, R. Damiano, C. Battaglino, and A. Pizzo. Automatic annotation of characters’ emotions in
stories. pp. 117–129, 11 2015. https://doi.org/10.1007/978-3-319-27036-4_11
41. S. Abrilian, L. Devillers, S. Buisine, and J.-C. Martin. Emotv1: Annotation of real-life emotions for the
specifications of multimodal affective interfaces. 01 2005.
42. L. Vidrascu and L. Devillers. Annotation and detection of blended emotions in real human-human dia-
logs recorded in a call center. vol. 0, pp. 944–947, 01 2005. https://doi.org/10.1109/ICME.2005.
1521580
43. S. Abrilian, L. Devillers, and J.-C. Martin. Annotation of emotions in real-life video interviews: Variability
between coders. 01 2006.
44. Stella M. Text-mining forma mentis networks reconstruct public perception of the STEM gender gap in
social media. PeerJ Computer Science. 2020; 6:e295. https://doi.org/10.7717/peerj-cs.295 PMID:
33816946
45. Scarantino A. and Griffiths P. Don’t give up on basic emotions. Emotion Review, 3:444–454, 09 2011.
https://doi.org/10.1177/1754073911410745
46. Ekman P. Basic emotions. Handbook of cognition and emotion, 98(45-60):16, 1999.
47. Cowen A. S. and Keltner D. Self-report captures 27 distinct categories of emotion bridged by continuous
gradients. Proceedings of the National Academy of Sciences, 114(38):E7900–E7909, 2017. https://
doi.org/10.1073/pnas.1702247114 PMID: 28874542
48. Parrott W. G. Emotions in social psychology: Essential readings. psychology press, 2001.
49. Susanto Y., Livingstone A. G., Ng B. C., and Cambria E. The hourglass model revisited. IEEE Intelligent
Systems, 35(5):96–102, 2020. https://doi.org/10.1109/MIS.2020.2992799
50. Cambria E., Livingstone A., and Hussain A. The hourglass of emotions. In Cognitive behavioural
systems, pp. 144–157. Springer, 2012.
51. C. Liu, M. Osama, and A. de Andrade. DENS: A dataset for multi-class emotion analysis. CoRR, abs/
1910.11769, 2019.
52. A. Rakhmetullina, D. Trautmann, and G. Groh. Distant supervision for emotion classification task using
emoji 2 emotion. 2018.
53. R. Sprugnoli. Multiemotions-it: A new dataset for opinion polarity and emotion analysis for Italian. In 7th
Italian Conference on Computational Linguistics, CLiC-it 2020, pp. 402–408. Accademia University
Press, 2020.
54. M. Abdul-Mageed and L. Ungar. EmoNet: Fine-grained emotion detection with gated recurrent neural
networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics
(Volume 1: Long Papers), pp. 718–728. Association for Computational Linguistics, Vancouver, Canada,
July 2017. https://doi.org/10.18653/v1/P17-1067
55. Kagita N. Role of emotions in the FMCG branding and their purchase intentions. Vidwat, 11(1):24–28,
2018.
56. E. Öhman, M. Pàmies, K. Kajava, and J. Tiedemann. Xed: A multilingual dataset for sentiment analysis
and emotion detection, 2020.
57. Caluza L. J. Deciphering west philippine sea: A plutchik and vader algorithm sentiment analysis. Indian
Journal of Science and Technology, 11:1–12, 12 2017. https://doi.org/10.17485/ijst/2018/v11i47/
130980
58. M. A. Mohsin and A. Beltiukov. Summarizing emotions from text using plutchik’s wheel of emotions.
2019.
59. Chesi P., Marini M., Mancardi G., Patti F., Alivernini L., Bisecco A., et al. Listening to the neurological
teams for multiple sclerosis: the smart project. Neurological Sciences, 41, 03 2020. https://doi.org/10.
1007/s10072-020-04301-z PMID: 32198654
60. Balakrishnan V. and Kaur W. String-based multinomial naïve bayes for emotion detection among Face-
book diabetes community. Procedia Computer Science, 159:30–37, 2019. Knowledge-Based and
Intelligent Information & Engineering Systems: Proceedings of the 23rd International Conference
KES2019. https://doi.org/10.1016/j.procs.2019.09.157
61. T. Ulusoy, K. T. Danyluk, and W. J. Willett. Beyond the physical: Examining scale and annotation in vir-
tual reality visualizations. Technical report, Department of Computer Science, University of Calgary,
2018.
62. P. Balouchian and H. Foroosh. Context-sensitive single-modality image emotion analysis: A unified
architecture from dataset construction to cnn classification. pp. 1932–1936, 10 2018. https://doi.org/10.
1109/ICIP.2018.8451048
63. H. Rashkin, A. Bosselut, M. Sap, K. Knight, and Y. Choi. Modeling naive psychology of characters in
simple commonsense stories. In Proceedings of the 56th Annual Meeting of the Association for Compu-
tational Linguistics (Volume 1: Long Papers), pp. 2289–2299. Association for Computational Linguis-
tics, Melbourne, Australia, July 2018. https://doi.org/10.18653/v1/P18-1213
64. Ranco G., Aleksovski D., Caldarelli G., Grčar M., and Mozetič I. The effects of Twitter sentiment on
stock price returns. PloS one, 10:e0138441, 09 2015. https://doi.org/10.1371/journal.pone.0138441
PMID: 26390434
65. K. Kukk. Correlation between emotional tweets and stock prices. 2019.
66. O. Zhurakovskaya, L. Steinkamp, K. M. Tymann, and C. Gips. An emotion detection tool composed of
established techniques.
67. R. Sharma, D. Pandey, S. Zith, and S. Babu. Sentiment analysis of Facebook & Twitter using soft
computing. pp. 2457–1016, 08 2020.
68. R. Sawhney, H. Joshi, S. Gandhi, and R. R. Shah. A time-aware transformer based model for suicide
ideation detection on social media. In Proceedings of the 2020 Conference on Empirical Methods in
Natural Language Processing (EMNLP), pp. 7685–7697. Association for Computational Linguistics,
Online, Nov. 2020. https://doi.org/10.18653/v1/2020.emnlp-main.619
69. H. Tanabe, T. Ogawa, T. Kobayashi, and Y. Hayashi. Exploiting narrative context and a priori knowl-
edge of categories in textual emotion classification. In Proceedings of the 28th International Conference
on Computational Linguistics, pp. 5535–5540. International Committee on Computational Linguistics,
Barcelona, Spain (Online), Dec. 2020. https://doi.org/10.18653/v1/2020.coling-main.483
70. S. F. Yilmaz, E. B. Kaynak, A. Koç, H. Dibeklioğlu, and S. S. Kozat. Multi-label sentiment analysis on
100 languages with dynamic weighting for label imbalance, 2020.
71. Treceñe J. K. D. Delving the sentiments to track emotions in gender issues: A plutchik-based sentiment
analysis in students’ learning diaries. International Journal of Scientific & Technology Research,
8:1134–1139, 2019.
72. N. Bader, O. Mokryn, and J. Lanir. Exploring emotions in online movie reviews for online browsing. In
Proceedings of the 22nd International Conference on Intelligent User Interfaces Companion, IUI’17
Companion, p. 35–38. Association for Computing Machinery, New York, NY, USA, 2017. https://doi.
org/10.1145/3030024.3040982
73. H.-Y. Yu and B.-C. Bae. Emotion and sentiment analysis from a film script: A case study. 2018.
74. J. Jenkins. Detecting emotional ambiguity in text. 4:55–57, 05 2020. https://doi.org/10.15406/mojabb.
2020.04.00134
75. Stella M., Restocchi V., and De Deyne S. #lockdown: Network-enhanced emotional profiling in the time
of covid-19. Big Data and Cognitive Computing, 4(2), 2020. https://doi.org/10.3390/bdcc4020014
76. Cockburn A., Karlson A., and Bederson B. B. A review of overview+ detail, zooming, and focus+ context
interfaces. ACM Computing Surveys (CSUR), 41(1):1–31, 2009. https://doi.org/10.1145/1456650.
1456652
77. Furnas G. W. Generalized fisheye views. Acm Sigchi Bulletin, 17(4):16–23, 1986. https://doi.org/10.
1145/22339.22342
78. J. McAuley, C. Targett, Q. Shi, and A. Van Den Hengel. Image-based recommendations on styles and
substitutes. In Proceedings of the 38th international ACM SIGIR conference on research and develop-
ment in information retrieval, pp. 43–52, 2015.
79. Mohammad Saif M and Turney Peter D. Crowdsourcing a word-emotion association lexicon. In Compu-
tational intelligence, 29, 3, p. 436–465, Wiley Online Library, 2013. http://saifmohammad.com/
WebPages/NRC-Emotion-Lexicon.htm. https://doi.org/10.1111/j.1467-8640.2012.00460.x
80. O. Hany. IMDB top 1000 | Kaggle, 2021.
81. Propp V. Morphology of the Folktale, vol. 9. University of Texas Press, 2010.
82. S. M. Mohammad, S. Kiritchenko, P. Sobhani, X. Zhu, and C. Cherry. Semeval-2016 task 6: Detecting
stance in tweets. In Proceedings of the International Workshop on Semantic Evaluation, SemEval’16.
San Diego, California, June 2016.