1234567891011121314151617 |
- import pandas as pd
- import numpy as np
- import matplotlib.pyplot as plt
- import seaborn as sns
- import squarify
- data = {'labels': ["video","editing","resource","Subtitle","record","film", "video produce","youtuber","video editing","video resource"],
- 'values':[50000,5000,50000,5000,5000,500,5000,50000,50000,5000]}
- df = pd.DataFrame(data)
- colors=['#fae588','#f79d65','#f9dc5c','#e8ac65','#e76f51','#ef233c','#b7094c'] #color palette
- sns.set_style(style="whitegrid") # set seaborn plot style
- sizes= df["values"].values# proportions of the categories
- label=df["labels"]
- squarify.plot(sizes=sizes, label=label, alpha=0.6,color=colors).set(title='Treemap with Squarify')
- plt.axis('off')
- plt.savefig("../img/filename.png", dpi = 300)
|