I wanted to use python to draw a Christmas tree, but I thought of seaborn.swarmplot . It really looks like a closer look. Let’s make it a Christmas tree~~~~~~
import seaborn as sns
import matplotlib.pyplot as plt
plt.figure(dpi=170)
tips = sns.load_dataset("tips")
ax = sns.swarmplot(
x=tips["total_bill"],
color='green',#也可以指定调色盘
orient='v',
**dict(marker='*', s=7),#marker属性设置
)
plt.axis('off')
plt.show()
Change to Clover's Christmas Tree~~~
import seaborn as sns
import matplotlib.pyplot as plt
plt.figure(dpi=170)
tips = sns.load_dataset("tips")
ax = sns.swarmplot(
x=tips["total_bill"],
color='green',
orient='v',
**dict(marker='$\clubsuit$', s=7),
)
plt.axis('off')
plt.show()
Draw a careful Christmas tree~~~
import seaborn as sns
import matplotlib.pyplot as plt
plt.figure(dpi=170)
tips = sns.load_dataset("tips")
ax = sns.swarmplot(
x=tips["total_bill"],
color='red',
orient='v',
**dict(marker='$\heartsuit$', s=9,),
)
plt.axis('off')
plt.show()
More shape stamps: Python visualization|matplotlib03-One article to master the use of marker and linestyle
Group painting~~~
import seaborn as sns
import matplotlib.pyplot as plt
plt.figure(dpi=170)
tips = sns.load_dataset("tips")
ax = sns.swarmplot(
x="time",
y="total_bill",
data=tips,
size=6,
color='green',
orient='v',
palette='Set1',#调色盘
**dict(marker='*', s=7),
)
plt.axis('off')
plt.show()
More detailed grouping~~~~
import seaborn as sns
import matplotlib.pyplot as plt
plt.figure(dpi=170)
tips = sns.load_dataset("tips")
ax = sns.swarmplot(
x="day",
y="total_bill",
#hue="sex",
data=tips,
color='green',
orient='v',
palette='Set1',
**dict(marker='*', s=7),
)
plt.axis('off')
plt.show()