Skip to content

Instantly share code, notes, and snippets.

@aletelecom
Created July 23, 2022 02:27
Show Gist options
  • Save aletelecom/1b66a45239bff9e7e675519dc4fd3fa5 to your computer and use it in GitHub Desktop.
Save aletelecom/1b66a45239bff9e7e675519dc4fd3fa5 to your computer and use it in GitHub Desktop.
Viz 2
#from matplotlib.pyplot import annotate
plt.rcParams.update({'font.size':25, 'figure.figsize': (30,10)})
# Calculate the mean of ocupation, and the x axis of the text
mean = concat_df['ocupation_%'].mean()
text_x = concat_df['client_qty'].max() / 10
# Create the scatter plot, the horizontal line, and the text
ax = concat_df.plot(kind='scatter', x='client_qty', y='ocupation_%', color='blue')
ax.axhline(mean, lw=8, color='green', label='Mean')
ax.text(text_x,mean, 'Mean occupation: {:.2f}'.format(mean), fontsize=25, va='center', ha='center', backgroundcolor='w')
ax.set_title('Traffic occupation percentage vs client quantity')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment