Untitled
unknown
plain_text
a year ago
1.2 kB
4
Indexable
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd data = { 'Teknologjia': ['Python', 'Java', 'Javascript', 'C#', 'Ruby'], 'Market': ['USA', 'Europe', 'Asia', 'Afrike', 'Indi'], 'Vende pune': [400, 300, 200, 350, 500] } df = pd.DataFrame(data) scale_factor = 50 df['Bubble Size'] = df['Vende pune'] / scale_factor plt.figure(figsize=(12, 8)) scatter = sns.scatterplot( data=df, x='Vende pune', y='Market', size='Bubble Size', sizes=(100, 1000), alpha=0.7, edgecolor='w' ) for index, row in df.iterrows(): plt.annotate(row['Teknologjia'], xy=(row['Vende pune'], row['Market']), xytext=(5, -8), textcoords='offset points', ha='center', va='center', fontsize=10, color='black') plt.title('Shperndarja e puneve sipas profileve teknologjike') plt.xlabel('Nr i vendeve te punes sipas kontinenteve') plt.ylabel('Market') plt.grid(True) plt.xticks(rotation=45) plt.tight_layout() plt.ylim(-0.5, len(df['Market']) - 0.5) plt.legend(*scatter.legend_elements("sizes", num=5), title="Bubble Size") plt.show()
Editor is loading...
Leave a Comment