简体   繁体   English

Plot 列从不同的 dataframe 成一张线图

[英]Plot Column from different dataframe into one chart of lines

I have two dataframes with the same headers.我有两个具有相同标题的数据框。 I want to plot the 'Close' column from both data frames into one chart of lines.我想将两个数据帧中的“关闭”列 plot 转换为一张折线图。

so I have:所以我有:

(aapl.Close).plot()

and

(tsla.Close).plot()

which clearly does what I need to plot but in two different charts.这显然可以满足我对 plot 的要求,但在两个不同的图表中。 I need two lines in one line chart.我需要在一个折线图中有两条线。

Tried the below, literally after I posted.在我发布之后尝试了以下内容。

fig = plt.figure() ax = fig.add_subplot() fig = plt.figure() ax = fig.add_subplot()

ax.plot(aapl.Close) ax.plot(tsla.Close) ax.plot(aapl.Close) ax.plot(tsla.Close)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Plotly:如何在来自同一 Pandas 数据帧的不同列的一个绘图图表中绘制多条线? - Plotly: How to plot multiple lines in one plotly chart from different columns from the same pandas dataframe? 如何 plot 多行在一个 plotly 图表中来自同一列的同一列 pandas Z6A8064B5DF47945550705553? - How to plot multiple lines in one plotly chart from same column from the same pandas dataframe? Matplotlib 从 Dataframe 中的一列绘制不同的线 - Matplotlib plotting different lines from one column in Dataframe 如何在一个 plot 中堆叠 dataframe 列中的 plot 多行? [Python] - How to plot many lines from stacked dataframe column in one plot? [python] 从一个数据框中绘制多条线并添加辅助轴以绘制不同的数据框 - Pandas - Plotting multiple lines from one dataframe and adding a secondary axis to plot a different dataframe - Pandas 如何从数据框中以列标题为 x 轴绘制线条 - How to plot lines from a dataframe with column headers as the x-axis 如何从特定 DataFrame 列的条形图中 plot 值 - How to plot values in a bar chart from a specific DataFrame column 如何 plot 从 object dataframe 列中的 Z23EEEB4347BDD2576BFC6B7EE9AB 中的饼图? - How to plot a pie chart from an object dataframe column in python? 从图表中提取 plot 行 - Extract plot lines from chart 从熊猫数据框中绘制数据线,由一列中的键而不是由不同列标识 - Plotting data lines from pandas dataframe, identified by keys in one column instead by different columns
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM