X 轴没有为 Pandastable 中的绘图选择正确的列 [英] X axis not picking correct column for plot in pandastable

查看:70
本文介绍了X 轴没有为 Pandastable 中的绘图选择正确的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两列数据框,我想绘制数据,因为 pandastable 中已有绘图函数.如何在 pandastable 图中设置 x 轴列.我选择两列作为 x 轴 &另一个作为 y 轴,xaxis 我想是字符串时间和 y 轴作为值,情节即将正确,但 x 轴被接受为时间列,

I have two column dataframe and i want to plot the data as already plot function is there in pandastable . How I can set the x axis column in pandastable plot. I am selecting two columns one as x axis & another as y axis , xaxis i want to be string time and y axis as value , Plot is coming correct but x axis is accepting as time column ,

import tkinter as tk
import pandas as pd
from pandastable import Table
root=tk.Tk()
df=pd.DataFrame({'Time':['10:00','11:00','12:00','13:00'],'value':[111,333,222,444],})

table_frame=tk.Frame(root)
table_frame.pack()

pt=Table(table_frame,dataframe=df,showstatusbar=True,showtoolbar=True)
pt.show()

root.mainloop()

我希望我的情节将时间列作为 x 轴 &值作为图中的 y 轴.

I want my plot to take Time column as x axis & value as y axis in plot.

推荐答案

如果您希望字符串时间列作为 x 轴,您可以按时间列数据对绘图进行分组.这可以在图中看到

If you want your string time column to be your x axis you can just group plot by time column data. That can be seen in the figure

这篇关于X 轴没有为 Pandastable 中的绘图选择正确的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆