首页 > 代码库 > Data Visualizations 1
Data Visualizations 1
1.Independent variables : each variable is saperate from others in the dataset.
2.Data scatter:
weight = [600,150,200,300,200,100,125,180]
height = [60,65,73,70,65,58,66,67] # dataset
import matplotlib.pyplot as plt # import pyplot from matplotlib
plt.scatter(height, weight) # scatter(x,y)
plt.show() #show the plot
3. Scatter function can scatter both list and Series format
4. Line chart is similar to scatter.
5. Use Range() function to replace .index. Because Range() can also generate a list of numbers .
6. How to plot two data sets in the Dataframe :
a. Convert two data (y column) into a Series by using pivot.table. Example:area_by_month = forest_fires.pivot_table(index="month", values="area", aggfunc=numpy.mean)
b. Plot the Series into the format we need to show by using .index or range(len()) function.
7. Use plt.style.use("ggplot") to change the style of the plot.
Data Visualizations 1