Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
python:first_course_statistics [2016/10/19 14:57] Beretta, Anna Letizia |
python:first_course_statistics [2016/10/24 14:30] Beretta, Anna Letizia [Scatterplot (p.18)] |
||
---|---|---|---|
Ligne 134: | Ligne 134: | ||
plt.show() | plt.show() | ||
</code> | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | =====Scatterplot (p. 17)===== | ||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | adoption_scatterplot = pd.read_csv('...\adopt.TAB', '\t') | ||
+ | adopt_data_Xax = adoption_scatterplot['Visa88'] | ||
+ | adopt_data_Yax = adoption_scatterplot['Visa91'] | ||
+ | plt.scatter(adopt_data_Xax, adopt_data_Yax, facecolor='y', edgecolor='y') | ||
+ | ax = plt.gca() | ||
+ | ax.set_xlabel('Number of Visas in 1988') | ||
+ | ax.set_ylim([0,2700]) | ||
+ | ax.set_xlim([0,5000]) | ||
+ | ax.set_ylabel('Number of Visas in 1991') | ||
+ | ax.set_title('ScatterPlot of Visa91 vs Visa88') | ||
+ | plt.show() | ||
+ | </code> | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | =====Scatterplot (p.18)===== | ||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | import pandas as pd | ||
+ | adoption_scatterplot = pd.read_csv('D:\Python\Libri\A_Casebook_for_a_First_Course_in_Statistics_and_Data_Analysis_Datasets\Data\Tab\\adopt.TAB', '\t') | ||
+ | adopt_data_Xax = adoption_scatterplot['Visa91'] | ||
+ | adopt_data_Yax = adoption_scatterplot['Visa92'] | ||
+ | plt.scatter(adopt_data_Xax, adopt_data_Yax, facecolor='y', edgecolor='y') | ||
+ | ax = plt.gca() | ||
+ | ax.set_xlabel('Number of Visas in 1991') | ||
+ | ax.set_ylim([0,1800]) | ||
+ | ax.set_xlim([0,2700]) | ||
+ | ax.set_ylabel('Number of Visas in 1992') | ||
+ | ax.set_title('ScatterPlot of Visa92 vs Visa91') | ||
+ | plt.show() | ||
+ | </code> | ||
+ | |||
+ |