Python Basic Waffle diagram

Photo by Mae Mu on Unsplash

So I’m going to set up an new environment using condas.

conda create -n waffle python=3.8 anaconda
conda activate waffle
conda install -n waffle -c conda-forge nb_conda
conda install -n waffle -c conda-forge pandas
conda install -n waffle -c conda-forge matplotlib
conda install -n waffle -c conda-forge pywaffle

Kick off jupter notebook:

jupyter notebook&

Create a new Notebook:

import pandas as pd 
import matplotlib.pyplot as plt 
from pywaffle import Waffle  
data ={'hosts': ['CentOS6', 'CentOS7', 
                 'CentOS8', 'OL7', 'OL6'], 
       'number': [30, 135, 23, 12, 3] 
     } 
df = pd.DataFrame(data) 
fig = plt.figure( 
   FigureClass = Waffle, 
   rows = 8, 
   values = df.number, 
   labels = list(df.hosts))

Leave a Reply

Your email address will not be published. Required fields are marked *