Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

radar chart different scales python

import numpy as np
import matplotlib.pyplot as plt

class Radar(object):
    def __init__(self, figure, title, labels, rect=None):
        if rect is None:
            rect = [0.05, 0.05, 0.9, 0.9]

        self.n = len(title)
        self.angles = np.arange(0, 360, 360.0/self.n)

        self.axes = [figure.add_axes(rect, projection='polar', label='axes%d' % i) for i in range(self.n)]

        self.ax = self.axes[0]
        self.ax.set_thetagrids(self.angles, labels=title, fontsize=14)

        for ax in self.axes[1:]:
            ax.patch.set_visible(False)
            ax.grid(False)
            ax.xaxis.set_visible(False)

        for ax, angle, label in zip(self.axes, self.angles, labels):
            ax.set_rgrids(range(1, 6), angle=angle, labels=label)
            ax.spines['polar'].set_visible(False)
            ax.set_ylim(0, 5)

    def plot(self, values, *args, **kw):
        angle = np.deg2rad(np.r_[self.angles, self.angles[0]])
        values = np.r_[values, values[0]]
        self.ax.plot(angle, values, *args, **kw)


if __name__ == '__main__':
    fig = plt.figure(figsize=(8, 8))

    tit = list('ABCDEFGHIJKJ')

    lab = [
        list('abcde'),
        list('12345'),
        list('uvwxy'),
        ['one', 'two', 'three', 'four', 'five'],
        list('jklmn'),
        list('jklmn'),
        list('jklmn'),
        list('jklmn'),
        list('jklmn'),
        list('jklmn'),
        list('jklmn'),
        list('jklmn')
    ]

    radar = Radar(fig, tit, lab)
    radar.plot([1, 3, 2, 1, 3, 1, 1, 1, 1, 2, 3, 1],  '-', lw=2, color='b', alpha=0.4, label='first')
    radar.plot([2, 2, 3, 3, 3, 2, 2, 2, 0, 2, 3, 2], '-', lw=2, color='r', alpha=0.4, label='second')
    radar.plot([3, 4, 3, 1, 2, 2, 4, 3, 1, 2, 3, 3], '-', lw=2, color='g', alpha=0.4, label='third')
    radar.ax.legend()
Comment

PREVIOUS NEXT
Code Example
Python :: tensorflow configure multiple gpu 
Python :: python locateonscreen method 
Python :: Python NumPy append Function Example Working with axis 
Python :: Python NumPy dsplit Function Syntax 
Python :: python os.listdir attributes 
Python :: https://www.geeksforgeeks.org/matplotlib-axes-axes-cla-in-python/ 
Python :: How to obtain a jpeg resolution in python 
Python :: __truediv__ 
Python :: modles en django 
Python :: python mxs Classof 
Python :: count matching in two strings 
Python :: NumPy bitwise_or Code When inputs are Boolean 
Python :: pymenu example 
Python :: http://172.18.0.128:8114/ 
Python :: jenkins crumb python request 
Python :: penggunaan values di python 
Python :: extract numbers from image python 
Python :: manager.dict() append 
Python :: comprehension 
Python :: merge csv files into one 
Python :: pyxl activate sheet 
Python :: How to setup Conda environment and package access extension from within Jupyter 
Python :: Converting Data Types 
Python :: KeyError: 0 python 
Python :: how to close python in terminal 
Python :: easy ocr python pypi 
Python :: Lambda expressions using f-string 
Python :: get next element while looping 
Python :: create a separate dataframe with the columns 
Python :: pip is not recognized as an internal or external command 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =