Scatter plot with variable marker size (seaborn)

前端 未结 1 708
梦谈多话
梦谈多话 2021-01-03 06:51

I am using a seaborn pairplot to plot a scatter plot of different dimensions of my datapoints. However, I want the markers of the datapoints to have a size that

1条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-03 07:38

    import seaborn as sns
    import matplotlib.pyplot as plt
    iris = sns.load_dataset("iris")
    
    size = 100 * (iris.petal_length / iris.petal_length.max())
    g = sns.PairGrid(iris, vars=["sepal_length", "sepal_width"], size=5)
    g.map(plt.scatter, s=size)
    

    0 讨论(0)
提交回复
热议问题