Matplotlib绘制散点图仅显示第二组数据集问题求助
散点图仅显示第二组数据集的问题
我确认操作步骤无误,但运行代码后生成的散点图只显示test数据集的红色散点,train数据集的绿色散点完全看不到。
代码如下:
fig = plt.figure() ax1 = fig.add_subplot(111) ax1.scatter(train["ENGINESIZE"], train["CO2EMISSIONS"], color = "green") ax1.scatter(test["ENGINESIZE"], test["CO2EMISSIONS"], color = "red") plt.xlabel("Engine Size") plt.ylabel("Emission") plt.show()
内容的提问来源于stack exchange,提问作者Mohammad Hossein Mahmoudi
相关产品推荐
相关产品推荐

