Open In App

Circular Visualization of Dataset using hishiryo Python

Last Updated : 06 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Among various ways to represent data, circular representation of data is one of the ways to render data points and do a corresponding analysis of the same. This article talks about ways to achieve the said visualization of data for further analytical purposes.

hishiryo: This tool helps in the generation of circular visual representation of data. Converts each data point to pixel, and then displayed it to circular graphs and supports various data types such as integers, floats, and text as its categorical columns.

Installation:

This module does not come built-in with Python. To install it type the below command in the terminal.

pip install hishiryo

After installation, the target dataset is required to proceed with the coding part.

Function Used

HishiryoConverter.convertCSVToRadialBitmap: Convert an input CSV file into a radial bitmap and save it on disk

Syntax: HishiryoConverter.convertCSVToRadialBitmap(input_path,separator,output_path,radius,None,”Dot”)

Parameters:

  • input path :  Path to csv.
  • output path :  Path to image file.
  • separator : Character separator in your csv (e.g. “,”)
  • radius (in pixel) : Size of radius of disk where pixel will be drawn. The higher it is, bigger and sharper image will be.
  • sort_by : Column by which data is required to be sorted.
  • glyph_type : Type of representation for the pixels. Options : [“Dot”,”Square” or “Polygon”].

Below is the implementation:

Python3




# import library
from hishiryo import Hishiryo
  
# initialize data set and parameters.
HishiryoConverter = Hishiryo.Hishiryo()
input_path = "iris.csv"
separator = ','
output_path = "iris.png"
radius = 1500
  
# utility function that converts
HishiryoConverter.convertCSVToRadialBitmap(input_path, 
                                           separator,
                                           output_path,
                                           radius, None,
                                           "Dot")


After running the code, process metadata is output at the console, and the corresponding image is output at the desired destination.

Output :

Colors Assignment:

Colors are assigned on the basis of variable type.

  • Blue circles – integer values
  • Red circles – float values
  • Random colors  – categorical variables.
  • Black – default or 0 or no data.

Using custom parameters, here we alter the dataset, glyph type, and radius.

Python3




# import library
from hishiryo import Hishiryo
  
HishiryoConverter = Hishiryo.Hishiryo()
  
# initialize data set and parameters.
input_path = "titanic.csv"
separator = ','
output_path = "titanic.png"
radius = 5000
  
# utility function that converts
# altered glyph type, dataset and radius
HishiryoConverter.convertCSVToRadialBitmap(input_path, separator,
                                           output_path, radius,
                                           None, "Polygon")


Output :



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads