All Projects → shahinrostami → Chord

shahinrostami / Chord

Licence: agpl-3.0
Python package for creating beautiful interactive Chord Diagrams. Pro version available at https://m8.fyi/chord

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Chord

Data Science Hacks
Data Science Hacks consists of tips, tricks to help you become a better data scientist. Data science hacks are for all - beginner to advanced. Data science hacks consist of python, jupyter notebook, pandas hacks and so on.
Stars: ✭ 273 (+25.81%)
Mutual labels:  data-science, data, data-visualization
Awesome Bigdata
A curated list of awesome big data frameworks, ressources and other awesomeness.
Stars: ✭ 10,478 (+4728.57%)
Mutual labels:  data-science, data, data-visualization
Openrefine
OpenRefine is a free, open source power tool for working with messy data and improving it
Stars: ✭ 8,531 (+3831.34%)
Mutual labels:  data-science, data, data-visualization
Just Dashboard
📊 📋 Dashboards using YAML or JSON files
Stars: ✭ 1,511 (+596.31%)
Mutual labels:  data-science, data, data-visualization
Graphia
A visualisation tool for the creation and analysis of graphs
Stars: ✭ 67 (-69.12%)
Mutual labels:  data-science, data, data-visualization
Data Science Resources
👨🏽‍🏫You can learn about what data science is and why it's important in today's modern world. Are you interested in data science?🔋
Stars: ✭ 171 (-21.2%)
Mutual labels:  data-science, data, data-visualization
Data Science Portfolio
A Portfolio of my Data Science Projects
Stars: ✭ 149 (-31.34%)
Mutual labels:  data-science, data-visualization
Ml Workspace
🛠 All-in-one web-based IDE specialized for machine learning and data science.
Stars: ✭ 2,337 (+976.96%)
Mutual labels:  data-science, data-visualization
Dash Oil And Gas Demo
Dash Demo App - New York Oil and Gas
Stars: ✭ 156 (-28.11%)
Mutual labels:  data-science, data-visualization
Matplotplusplus
Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
Stars: ✭ 2,433 (+1021.2%)
Mutual labels:  data-science, data-visualization
Lookerbot
Lookerbot lets you access all your Looker data from Slack! Super fun!
Stars: ✭ 138 (-36.41%)
Mutual labels:  data, data-visualization
Pzad
Курс "Прикладные задачи анализа данных" (ВМК, МГУ имени М.В. Ломоносова)
Stars: ✭ 160 (-26.27%)
Mutual labels:  data-science, data-visualization
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (-22.12%)
Mutual labels:  data-science, data-visualization
Datacompy
Pandas and Spark DataFrame comparison for humans
Stars: ✭ 147 (-32.26%)
Mutual labels:  data-science, data
Fantasy Basketball
Scraping statistics, predicting NBA player performance with neural networks and boosting algorithms, and optimising lineups for Draft Kings with genetic algorithm. Capstone Project for Machine Learning Engineer Nanodegree by Udacity.
Stars: ✭ 146 (-32.72%)
Mutual labels:  data-science, data-visualization
Py Quantmod
Powerful financial charting library based on R's Quantmod | http://py-quantmod.readthedocs.io/en/latest/
Stars: ✭ 155 (-28.57%)
Mutual labels:  data-science, data-visualization
Coffee Quality Database
Building the Coffee Quality Institute Database
Stars: ✭ 141 (-35.02%)
Mutual labels:  data-science, data
Airbyte
Airbyte is an open-source EL(T) platform that helps you replicate your data in your warehouses, lakes and databases.
Stars: ✭ 4,919 (+2166.82%)
Mutual labels:  data-science, data
Volbx
Graphical tool for data manipulation written in C++/Qt
Stars: ✭ 187 (-13.82%)
Mutual labels:  data, data-visualization
Dtale
Visualizer for pandas data structures
Stars: ✭ 2,864 (+1219.82%)
Mutual labels:  data-science, data-visualization

ChordPRO

Chord PRO Released

Chord PRO is the full-featured chord visualization API, producing beautiful interactive visualizations, e.g. those featured on the front page of Reddit.

  • Produce beautiful interactive Chord diagrams.
  • Customize colours and font-sizes.
  • Access Divided mode, enabling two sides to your diagram.
  • Add images and text on hover,
  • Access finer-customisations including HTML injection.
  • Allows commercial use without open source requirement.
  • Currently supports Python, JavaScript, and Rust, with many more to come (accepting requests).

Get it here!

Changelog:

  • 05 February 2021 - Chord PRO nows supports better error messages.

  • 20 January 2021 - Chord PRO now supports show(), to_html(), show_png(), to_png(), and to_pdf().

  • 16 January 2021 - Chord PRO now supports disabling the custom font with load)font=False.

  • 16 January 2021 - Chord PRO now supports offsetting rotation with rotate.

  • 05 January 2021 - Chord PRO now supports label wrapping with wrap_labels.

  • 23 December 2020 - Chord PRO now supports reverse_gradients.

reverse_gradients

  • 02 December 2020 - Chord PRO now has [better support] for text customisation with the conjunction parameter.

  • 21 November 2020 - Chord PRO now has better support for asymmetric chord diagrams.

  • 03 November 2020 - Chord PRO now supports nodes with no relationships.

  • 26 October 2020 - Chord PRO now supports Downloading to image when multiple Chord diagrams appear on the same page.

  • 03 October 2020 - Chord PRO now supports visualising occurrences as well as co-occurrences.

  • 29 August 2020 - Chord PRO now supports enabling a Download to image button.

  • 16 August 2020 - Chord PRO now supports radius scaling and bipartite titles.

  • 13 August 2020 - Chord PRO now supports Arc numbers.

  • 23 July 2020 - Chord PRO now supports figure titles.

  • 20 July 2020 - Chord PRO now supports asymmetric mode using symmetric=False! You can also override the verb used in the popup.

  • 14 July 2020 - Chord PRO can now be enabled by entering your license key.

  • 29 June 2020 - Optimisation and bug fixes to the tooltip have massively improved the interactive performance of the visualisation (Rebuild your chord diagrams to take advantage of this change).

  • 22 May 2020 - Optimisation and bug fixes have massively improved the interactive performance of the visualisation (Rebuild your chord diagrams to take advantage of this change).

  • 21 May 2020 - Please update to the latest version of chord. Backwards compatibility has been introduced, so from this version onwards, new versions won't break older ones!

Example Image

Introduction

In a chord diagram (or radial network), entities are arranged radially as segments with their relationships visualised by arcs that connect them. The size of the segments illustrates the numerical proportions, whilst the size of the arc illustrates the significance of the relationships1.

Chord diagrams are useful when trying to convey relationships between different entities, and they can be beautiful and eye-catching.

The Chord Package

I wanted to do a section on Chord Diagrams for my book, Data Is Beautiful.

With Python in mind, there are many libraries available for creating Chord diagrams, such as Plotly, Bokeh, and a few that are lesser-known. However, I wanted to use the implementation from d3 because it can be customised to be highly interactive and to look beautiful.

I couldn't find anything that ticked all the boxes, so I made a wrapper around d3-chord myself. It took some time to get it working, but I wanted to hide away everything behind a single constructor and method call. The tricky part was enabling multiple chord diagrams on the same page and then loading resources in a way that would support Jupyter Lab.

The primary support is for Jupyter Lab (not the older Jupyter Notebook).

Installation

Available on https://pypi.org/project/chord/ through pip:

pip install chord

Usage

Python

Python (HTML file)

Chord(matrix, names).to_html()

Jupyter Lab (Notebook)

Chord(matrix, names).show()

Defaults

Chord (free)

Chord(self,
        matrix,
        names,
        colors="d3.schemeSet1",
        opacity=0.8,
        padding=0.01,
        width=700,
        label_color="#454545",
        wrap_labels=False,
        margin=0,
        credit=False,
        font_size="16px",
        font_size_large="20px"      
    )

Chord Pro

Chord(self,
        matrix,
        names,
        colors="d3.schemeSet1",
        opacity=0.8,
        padding=0.01,
        width=700,
        label_color="#454545",
        wrap_labels=False,
        margin=0,
        credit=False,
        font_size="16px",
        font_size_large="20px",
        details=[],
        details_thumbs=[],
        thumbs_width=85,
        thumbs_margin=5,
        thumbs_font_size=14,
        popup_width=350,
        noun="instances",
        details_separator=", ",
        divide=False,
        divide_idx=0,
        divide_size=0.5,
        instances=0,
        verb="occur together in",
        symmetric=True,
        title="",
        arc_numbers=False,
        divide_left_label="",
        divide_right_label="",
        inner_radius_scale=0.39,
        outer_radius_scale=1.1,
        allow_download=False,        
    )

Examples

You can see the actual interactive examples on this page. The below examples are screenshots.

The Dataset

The focus of this section will be the demonstration of the chord package. To keep it simple, we will use synthetic data that illustrates the co-occurrences between movie genres within the same movie.

matrix = [
    [0, 5, 6, 4, 7, 4],
    [5, 0, 5, 4, 6, 5],
    [6, 5, 0, 4, 5, 5],
    [4, 4, 4, 0, 5, 5],
    [7, 6, 5, 5, 0, 4],
    [4, 5, 5, 5, 4, 0],
]

names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy", "Thriller"]

Default Settings

Let's see what the Chord() defaults produce when we invoke the show() method.

Chord(matrix, names).show()

Example Image

You can also save it to an HTML file.

Chord(matrix, names).to_html()

Different Colours

The defaults are nice, but what if we want different colours? You can pass in almost anything from d3-scale-chromatic, or you could pass in a list of hexadecimal colour codes.

Chord(matrix, names, colors="d3.schemeSet2").show()

Example Image

Chord(matrix, names, colors=f"d3.schemeGnBu[{len(names)}]").show()

Example Image

Chord(matrix, names, colors="d3.schemeSet3").show()

Example Image

Chord(matrix, names, colors=f"d3.schemePuRd[{len(names)}]").show()

Example Image

Chord(matrix, names, colors=f"d3.schemeYlGnBu[{len(names)}]").show()

Example Image

hex_colours = ["#222222", "#333333", "#4c4c4c", "#666666", "#848484", "#9a9a9a"]

Chord(matrix, names, colors=hex_colours).show()

Example Image

Label Styling

We can disable the wrapped labels, and even change the colour.

Chord(matrix, names, wrap_labels=False, label_color="#4c40bf").show()

Example Image

Opacity

We can also change the default opacity of the relationships.

Chord(matrix, names, opacity=0.1).show()

Example Image

Diagram Size

We can change the maximum diagram size by specifying a width.

Chord(matrix, names, width=400).show()

We can change the padding between chord segments by specifying the padding.

Chord(matrix, names, padding=0.3).show()

  1. Tintarev, N., Rostami, S., & Smyth, B. (2018, April). Knowing the unknown: visualising consumption blind-spots in recommender systems. In Proceedings of the 33rd Annual ACM Symposium on Applied Computing (pp. 1396-1399). 

Data and Templates

Chord FREE package

The chord package switches to FREE mode when a username and license are not specified, or if they are both set to "free". This disables the use of all the PRO features.

This uses the Chord FREE API service hosted on the DataCrayon.com (AWS hosted) server to generate your visualisation.

Chord FREE uses the AGPL-3.0 License.

Chord PRO (full-featured) package

The chord package switches to PRO mode when a username and license are specified. This enables the use of all the PRO features.

This uses the Chord PRO API service hosted on the DataCrayon.com (AWS hosted) server to generate your visualisation.

Example Image


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].