Seaborn基础2
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
def sinplot(flip = 1):
x = np.linspace(0,14,100)
for i in range(1,7):
plt.plot(x,np.sin(x+i*0.5) * (7-i) * flip)
data = np.random.normal(size=(20,6)) + np.arange(6)/2
# 使用 despine 进行操作
# sns.violinplot(data)
# sns.despine(offset = 10)
# # offset 设置距离轴的距离
# plt.show()
# # 底部变为白色
# sns.set_style("whitegrid")
# # 让左面的竖线消失
# sns.boxplot(data = data,palette = "deep")
# sns.despine(left = True)
# plt.show()
# 五种主题风格 darkgrid whitegrid dark white ticks
# # 绘制子图
# with sns.axes_style("darkgrid"):
# # 第一种风格背景为黑色
# plt.subplot(211)
# # 分两个一列上面
# sinplot()
# plt.subplot(212)
# sinplot(-1)
# plt.show()
# # 设置布局,画图的大小和风格
# sns.set_context("paper")
# # sns.set_context("talk")
# # sns.set_context("poster")
# # sns.set_context("notebook")
# # 线条粗细依次变大
# plt.figure(figsize=(8,6))
# sinplot()
# plt.show()
# # 设置坐标字体大小 参数 font_scale
# sns.set_context("paper",font_scale=3)
# plt.figure(figsize=(8,6))
# sinplot()
# plt.show()
# # 设置线的粗度 rc = {"lines.linewidth":4.5}
# sns.set_context("paper",font_scale=1.5,rc={"lines.linewidth":3})
# plt.figure(figsize=(8,6))
# sinplot()
# plt.show()
2020-04-24
本文来自博客园,作者:CodeYaSuo,转载请注明原文链接:https://www.cnblogs.com/hany-postq473111315/p/12765847.html