我正在绘制一系列与时间相关的指标,并使用facet_grid
功能在一个对象上单独绘制每周。
result_df
:
week metric_a time_stamp
20 2567 2015-09-30 09:04:29
21 3567 2015-10-03 17:36:39
22 3455 2015-10-11 19:29:32
p = ggplot(aes(x='time_stamp',y='metric_a'),data=result_df) + scale_x_date(labels = date_format("%H:%M")) + geom_line() + facet_grid('week',scales='free_x')
我现在希望使用color
参数来说明几周之间的变化。
p = ggplot(aes(x='time_stamp',y='metric_a',color="week"),data=result_df) + scale_x_date(labels = date_format("%H:%M")) + geom_line() + facet_grid('week',scales='free_x')
然而,这会返回:
row, col = self.facets.facet_map[rowname]
为什么这是color参数而不是facet_grid
参数的问题?
答案 0 :(得分:0)
我进一步挖掘了错误跟踪,发现有一个隐藏的import sys
infilename = sys.argv[1]
outfilename = sys.argv[2]
infile = open (infilename)
outfile = open (outfilename, "w")
charct = 0
for line in (infile):
line = line.strip("\n")
charct = charct + len(line)
outfile.write(str(charct) + "\n")
infile.close()
outfile.close()
。我认为找到了this,表明您可以使用KeyError
。
需要进行编辑工作:
pd.categorical