Skip to content

Instantly share code, notes, and snippets.

@moyocoyani
Created December 4, 2020 00:15
Show Gist options
  • Save moyocoyani/1785da590fd628b7c846455df278ff27 to your computer and use it in GitHub Desktop.
Save moyocoyani/1785da590fd628b7c846455df278ff27 to your computer and use it in GitHub Desktop.
import seaborn as sns
#Dataset
tips = sns.load_dataset("tips")
#Plot----------------
#Canvas
fig,ax = plt.subplots(1,1,figsize=(13,7.5),dpi=100)
#Chart
sns.violinplot(x="day", y="total_bill", data=tips,ax=ax)
#Attributes axes
ax.set_axisbelow(True)
ax.set_xlabel("Days",
  ha="left",
  size=16)
ax.xaxis.set_label_coords(x=0, y=-0.08, transform=ax.transAxes)
ax.set_ylabel("Total bill",
  ha="right",
  size=16)
ax.yaxis.set_label_coords(x=-0.08, y=0.99, transform=ax.transAxes)
#Attributes plots
plt.locator_params(axis='y', nbins=4)
ax.spines["bottom"].set_color(palette["background"])
plt.suptitle("Total bill per day",
  horizontalalignment = 'left',
  x=0.05,
  y=0.99,
  transform=fig.transFigure,
  color=palette["background"],
  bbox=dict(facecolor=palette["primary"], edgecolor="none", pad=10.0))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment