Code Monkey home page Code Monkey logo

pyplutchik's Introduction

PyPlutchik

Python visualisation for Plutchik annotated corpora.

PyPlutchik is a module for visualizing the emotional fingerprint of corpora and text annotated with the Plutchik's model of emotions.

If you use it, please cite

Semeraro A, Vilella S, Ruffo G (2021) 
PyPlutchik: Visualising and comparing emotion-annotated corpora 
PLOS ONE 16(9): e0256503.https://doi.org/10.1371/journal.pone.0256503

Installation

Installation with pip:

pip3 install pyplutchik

Installation with conda:

conda install pyplutchik

Usage

from pyplutchik import plutchik

emotions = {'joy': 0.6,
            'trust': 0.4,
            'fear': 0.1,
            'surprise': 0.7,
            'sadness': 0.1,
            'disgust': 0.5,
            'anger': 0.4,
            'anticipation': 0.6}
            
plutchik(emotions)

Features

PyPlutchik provides a plug-and-play tool for a quantitative representation of Plutchik's emotions in a text or corpus. It is respectful of original colors and spatial displacement of each petal in the Plutchik's wheel. In Pyplutchik users can just pass a dictionary as only parameter, where dictionary's keys must be the 8 basic emotions. Each value must be โˆˆ [0, 1].

Example 1

Users can represent also the three degrees of intensity for each emotion, just by providing a 3-dimensional iterable as value for each key in the dictionary. The sum of the components of each 3-dimensional val must be between 0 and 1.

Example 2

PyPlutchik also represents primary dyads, secondary dyads, tertiary dyads and opposite emotions. It automatically understands what kind of dyad users want to display from the dictionary's keywords.

Example 3

Integration with matplotlib is easy, so PyPlutchik can be used for also for composed plots.

Full spectrum of emotions

A couple of tricks

One can focus on a subset of emotions, ignoring the remaining ones, passing a list of emotions as value of the parameter highlight_emotions:

Highlight some emotions

Or can hide coordinates, ticks and labels, plotting only the petals of the flower, using the parameters show_coordinates = False and show_ticklabels = False:

Small multiple

Full documentation

For a documentation of all parameters and a gallery of examples see the documentation.

๐Ÿ”ฅ PyPlutchik has been included in the Matplotlib's third-party and user-contributed packages list! ๐Ÿ”ฅ

pyplutchik's People

Contributors

alfonsosemeraro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.