# Python圖表屬性

Python具有用於數據可視化的一些很不錯的類庫。 Pandas，numpy和matplotlib的組合可以幫助創建幾乎所有類型的可視化圖表。 在本章中，我們將開始查看一些簡單的圖表和圖表的各種屬性。

## 創建圖表

``````import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0,10)
y = x ^ 2
#Simple Plot
plt.plot(x,y)
print('yes, all jobs done')``````

## 標記軸

``````import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0,10)
y = x ^ 2
#Labeling the Axes and Title
plt.title("Graph Drawing")
plt.xlabel("Time")
plt.ylabel("Distance")
#Simple Plot
plt.plot(x,y)``````

## 格式化線條類型和顏色

``````import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0,10)
y = x ^ 2
#Labeling the Axes and Title
plt.title("Graph Drawing")
plt.xlabel("Time")
plt.ylabel("Distance")

# Formatting the line colors
plt.plot(x,y,'r')

# Formatting the line type
plt.plot(x,y,'>')``````

## 保存圖表文件

``````import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0,10)
y = x ^ 2
#Labeling the Axes and Title
plt.title("Graph Drawing")
plt.xlabel("Time")
plt.ylabel("Distance")

# Formatting the line colors
plt.plot(x,y,'r')

# Formatting the line type
plt.plot(x,y,'>')

# save in pdf formats
plt.savefig('timevsdist.pdf', format='pdf')``````