Skip to content
Related Articles

Related Articles

Improve Article

Star Charts in Python

  • Last Updated : 09 Mar, 2021
Geek Week

Star plot or Radar Chart is used for displaying multivariate data, in which each variable provides the measure of some common property of each observation. Each star in the plot represents a single observation. Star plot is used to examine the relative values of a single data point and locate similar and dissimilar points.

The star plot consists of the sequence of equiangular spokes called radii with each spoke representing the value of observation on one of the variables. The data length of a spoke is proportional to the magnitude of the variable for the point related to the maximum data point in that variable. A line is drawn connecting to all the data points 

The star plot can be used to answer the following questions:

  • which variable is dominant for a given observation?
  • which observations are most similar i.e are there any clusters of observations?
  • are there outliers?


  • Star plot is generally used in sports visualizations and games such as FIFA, Pro Evolution Soccer (PES) to visualize the player’s strengths and weaknesses.
  • Star plot can also be used for quality improvement in order to visualize the different performance metrics.


  • Star plot is not a good way to visualize the ordinal or categorical variable which does not represent one category is better or worse than the other.
  • Star plot sometimes create a connection between two unrelated variables. That’s why a star plot cannot be trusted for making trade-off decisions.
  • The ordering of variables also affects the shape of the star plot. For Example, the values 9, 2, 9, 1, 9, 1 produce a different spike than 9, 9, 9, 2, 1, 1.


  • For this implementation, we will be using plotly and some general package. These packages are pre-installed in colaboratory but can be installed in the local environment. To install the plotly in the local environment, follow these instructions.
  • For this implementation, we will be using the FIFA-19 players dataset, you can obtain the dataset from Kaggle.


# code
import pandas as pd
import numpy as np
import as px
import plotly.graph_objects as go
# read dataset from csv and perform preprocessing
data = pd.read_csv('data.csv')
# remove goalkeepers data for performing fair comparison
goalkeeper_index = data[data['Position'] == 'GK' ].index
# remove columns which are not required for this visualisation purpose
plt_vars = ['SprintSpeed','Agility','Stamina','Aggression',
data.drop(data_cols, axis =1, inplace=True)
# plot unfilled scatter plot
px.line_polar(data, r = pd.Series(data.loc[1,plt_vars].values),
              title =
  f'{data.loc[1,"Name"]} \n Overall : {data.loc[1,"Overall"]} \
          Potential: {data.loc[1,"Potential"]}', width = 500)
# plot filled star plot
fig = go.Figure(data=go.Scatterpolar(
  name =
f'{data.loc[0,"Name"]}  (Overall : {data.loc[0,"Overall"]}  \
        Potential: {data.loc[0,"Potential"]} )'),)
  template = 'plotly_dark',
# plot star plot for comparison
fig = go.Figure()
      name=data.loc[1, 'Name']
      name=data.loc[0, 'Name']
    template = 'plotly_dark',

unfilled Star plot

Filled Star plot

Comparison with Star plot


Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the Machine Learning Foundation Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :