@@ -150,22 +150,16 @@ Python有多种可视化库,包括[seaborn](https://stanford.edu/~mwaskom/soft
150150
151151## 自定义图
152152
153- Now that we’ve made a basic first plot, we can move on to creating a more
154- customized second plot. We’ll make a basic histogram, then modify it to add
155- labels and other information.
153+ 现在,我们已经有了第一个基本的图,可以继续创建第二个更个性化的图了。我们会绘制一张基本的直方图,然后修改它,以添加标签及其他信息。
156154
157- One of the things we can look at is the age of the user accounts that are
158- tweeting. We’ll be able to find if there differences in when the accounts of
159- users who tweet about Trump and when the accounts of users who tweet about
160- Clinton were created. One candidate having more user accounts created recently
161- might imply some kind of manipulation of Twitter with fake accounts.
155+ 我们可以看的事情之一就是发微博的用户账号年龄。我们可以找到发关于Trump的微博的用户账号和发关于Clinton的微博的用户账号的创建时间之间是否有区别。拥有更多最近创建的用户账号的候选人可能意味着使用假账号进行某种Twitter操纵。
162156
163- In the code below, we’ll:
157+ 在下面的代码中,我们会:
164158
165- * Convert the ` created ` and ` user_created ` columns to the Pandas datetime type.
166- * Create a ` user_age ` column that is the number of days since the account was created.
167- * Create a histogram of user ages.
168- * Show the histogram.
159+ * 将 ` created ` 和 ` user_created ` 列转换成Pandas datetime类型。
160+ * 创建一个 ` user_age ` 列,表示从该账号创建后至今的天数。
161+ * 创建用户年龄直方图。
162+ * 显示该直方图。
169163
170164``` python
171165
@@ -183,25 +177,21 @@ In the code below, we’ll:
183177
184178### 添加标签
185179
186- We can add titles and axis labels to matplotlib plots. The common methods with
187- which to do this are:
180+ 我们可以添加标题和轴标签到matplotlib图中。完成这件事的通用方法是:
188181
189- * [ plt.title] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.title ) – adds a title to the plot.
190- * [ plt.xlabel] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xlabel ) – adds an x-axis label.
191- * [ plt.ylabel] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.ylabel ) – adds a y-axis label.
182+ * [ plt.title] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.title ) – 添加标题到图上。
183+ * [ plt.xlabel] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xlabel ) – 添加x轴标签。
184+ * [ plt.ylabel] ( http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.ylabel ) – 添加y轴标签。
192185
193- Since all of the methods we discussed before, like ` bar ` and ` hist ` ,
194- automatically create a Figure and a single Axes object inside the figure,
195- these labels will be added to the Axes object when the method is called.
186+ 由于我们之前讨论到的所有方法,像` bar ` 和` hist ` ,都会在figure中自动创建一个Figure和一个Axes对象,因此当调用该方法时,这些标签将会被添加到Axes对象上。
196187
197- We can add labels to our previous histogram using the above methods. In the
198- code below, we’ll:
188+ 我们可以用上面的方法添加标签到我们之前的直方图上。在下面的代码中,我们会:
199189
200- * Generate the same histogram we did before.
201- * Draw a title onto the histogram.
202- * Draw an x axis label onto the histogram.
203- * Draw a y axis label onto the histogram.
204- * Show the plot.
190+ * 生成我们之前完成的相同的直方图。
191+ * 画一个标题到该直方图。
192+ * 画一个x轴标签到该直方图上。
193+ * 画一个y轴标签到该直方图上。
194+ * 显示该图。
205195
206196``` python
207197
0 commit comments