考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

"关于以下绘图代码,哪一项说法是正确的? import matplotlib.pyplot as plt x = [0, 1, 2, 3] y1 = [0, 1, 4, 9] y2 = [0, 1, 2, 3] plt.plot(x, y1, label='square') plt.plot(x, y2, label='linear') plt.xlabel('x axis') plt.ylabel('y axis') plt.legend(loc='upper left') plt.title('Functions') plt.show()"
A. 图中两条曲线会被自动区分颜色和样式
B. legend(loc='upper left') 会隐藏图例
C. xlabel() 设置的是图例文字
D. 两条线会重叠,因为 plot() 只能画一条曲线
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

多次调用 plt.plot() 会自动区分颜色样式;legend() 负责显示图例,xlabel() 设置坐标轴标签。