Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 带有标记的散点图,根据表示的点的数量改变大小_Python_Scatter Plot - Fatal编程技术网

Python 带有标记的散点图,根据表示的点的数量改变大小

Python 带有标记的散点图,根据表示的点的数量改变大小,python,scatter-plot,Python,Scatter Plot,我正在绘制一个简单的散点图: 它正确地表示了我的数据,但是有许多带有坐标(1.00,1.00)的数据点,并且在绘图中,它们显示在单个标记(右上角)下。我想有一个功能,改变每一个标记的大小根据它所代表的点数。谢谢你的帮助。这是我的密码: def saveScatter(figureTitle, xFeature, yFeature, xTitle, yTitle): ''' save a scatter plot of xFeatures vs yFeatures ''' fig =

我正在绘制一个简单的散点图:

它正确地表示了我的数据,但是有许多带有坐标(1.00,1.00)的数据点,并且在绘图中,它们显示在单个标记(右上角)下。我想有一个功能,改变每一个标记的大小根据它所代表的点数。谢谢你的帮助。这是我的密码:

def saveScatter(figureTitle, xFeature, yFeature, xTitle, yTitle):
''' save a scatter plot of xFeatures vs yFeatures '''

    fig = plt.figure(figsize=(8, 6), dpi=300)
    ax = fig.add_subplot(111)    
    ax.scatter(dfModuleCPositives[names[xFeature]][:], dfModuleCPositives[names[yFeature]][:], c='r', marker='x', alpha=1, label='Module C Positives')
    ax.scatter(dfModuleCNegatives[names[xFeature]][:], dfModuleCNegatives[names[yFeature]][:], c='g', alpha=0.5, label='Module C Negatives')
    ax.scatter(dfModuleDPositives[names[xFeature]][:], dfModuleDPositives[names[yFeature]][:], c='k', marker='x', alpha=1, label='Module D Positives')
    ax.scatter(dfModuleDNegatives[names[xFeature]][:], dfModuleDNegatives[names[yFeature]][:], c='b', alpha=0.5, label='Module D Negatives')    
    ax.set_xlabel(xTitle, fontsize=10)
    ax.set_ylabel(yTitle, fontsize=10)
    ax.set_title(figureTitle)
    ax.grid(True)
    ax.legend(loc="lower right")
    fig.tight_layout()
    plt.show()
    return ax

散点法有一个
s
关键字参数,可用于调整应查看的标记大小。在您当前的框架中,可能需要进行大量的修改才能集成思想您是否有示例数据,即使只有几行?