官术网_书友最值得收藏!

Multiline plots

For example, to create a multiline plot, we can draw a line plot for each data series before concluding the figure. Let's try plotting the temperatures of three different cities with the following code:

import matplotlib.pyplot as plt

# Prepare the data series
d = [11,12,13,14,15,16,17]
t0 = [15.3,15.4,12.6,12.7,13.2,12.3,11.4]
t1 = [26.1,26.2,24.3,25.1,26.7,27.8,26.9]
t2 = [22.3,20.6,19.8,21.6,21.3,19.4,21.4]

# Plot the lines for each data series
plt.plot(d,t0)
plt.plot(d,t1)
plt.plot(d,t2)

plt.show()

Here is the plot generated by the preceding code:

This example is adapted from the maximum temperatures of three cities in a week in December 2017. From the graph, can you recognize which two lines are more likely to be representative of cities from the same continent?

主站蜘蛛池模板: 靖边县| 永春县| 亳州市| 漯河市| 高淳县| 昆明市| 垦利县| 新营市| 濮阳县| 彰化市| 闸北区| 三亚市| 龙陵县| 长春市| 庄河市| 安陆市| 措美县| 永康市| 文登市| 乐都县| 安泽县| 连云港市| 舞钢市| 犍为县| 辛集市| 肥乡县| 晋中市| 临猗县| 伊宁县| 富川| 榕江县| 天全县| 江津市| 眉山市| 依安县| 涟水县| 融水| 普宁市| 石台县| 班玛县| 泗阳县|