plt.plot(pf_f.loc["China"]) plt.plot(pf_f.loc["EU"]) plt.plot(pf_f.loc["US"]) plt.plot(pf_f.loc["Japan"]) plt.plot(pf_f.loc["Korea"]) plt.plot(pf_f.loc["Mexico"]) plt.legend(["China", "EU", "US", "Japan", "Korea
df.plot(secondary_y=['收盘价','20','50','200'],grid=True) plt.legend(('收盘价','20天','50天','200天'),loc='upper right') plt.show()
Creates a Heatmap plot from the data frame. Refer to Code A. In Code B, theyticksset the label and location of the y axis. Thenp.arangemethod returns equally spaced values within intervals. In this case, the country’s name is labeled between the box usingnp.arangeanddf.indexwith equa...
ylabel = "Number of cases", legend = false, ) 在一个图中绘制多个国家的时间序列非常简单。首先创建基本块,并为每个国家添加一层。 p = plot( title = "Confirmed Cases", xlabel = "Date", ylabel = "Number of cases", legend = :topleft, ) for country = ["US", "Russia", "India"] plot!
showlegend=False, xaxis=dict(title='单位: 摄氏度'), yaxis=dict(showticklabels=False) ) # 跳转网页显示 fig.show() Seaborn没有专门的函数来绘制山脊线图,可以多次调用kdeplot()来制作。 结果如下。 06.散点图 散点图,显示2个数值变量之间的关系。
animated_line_chart = (urban_df.sum(axis=1).pct_change().fillna(method='bfill').mul(100).plot_animated(kind="line", title="Total % Change in Population", period_label=False, add_legend=False)) animated_bar_chart = urban_df.plot_animated(n_visible=10, title='Top 10 Populous Countrie...
loc 指的是 location,iloc 中的 i 是指的是 integer,这两者的区别如下: loc:根据实际设置的 index 来索引数据 iloc:根据顺序数字来索引数据 import pandas as pd names = ["Bob", "Jessica", "Mary", "John", "Kate"] scores = [56, 11, 99, 83, 45] ...