如何从海运0.11+获得无填充的标记
问题描述
matplotlib.pyplot.scatter()有一个facecolors=None参数,它将使数据点看起来内部是空心的。如何获得与seaborn.jointplot()相同的外观?
在以前版本的Seborn中找到了相同的参数,但由于某种原因在最新版本(0.11)中被删除。
解决方案
- 由于
seaborn是matplotlib的高级API,这似乎反映了matplotlib中的功能
- 根据JointGrid documentation中的示例,参数为
fc。要使用fc,还应使用ec。- 指定
fc='none'而不指定ec将导致空白标记。
- 指定
'None'和'none'都可以,但None不行。
import seaborn as sns
# load data
penguins = sns.load_dataset("penguins", cache=False)
# set x and y
x, y = penguins["bill_length_mm"], penguins["bill_depth_mm"]
# plot
sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", ec="g", fc="none")
相关文章