【发布时间】:2019-07-29 18:36:05
【问题描述】:
我正在努力尝试制作一个将来自 ggplot2 形式 rpy2 的 2 个不同 DF 的数据组合在一起的图。
我不能让它工作,就像每次只能使用一个 DF。
我有 2 个 rpy2 df:
r_df1 = pandas2ri.py2rpy(df1)
r_df_int = pandas2ri.py2rpy(df_int)
第一个数据库是染色体、位置和变异特征的数据库:
df1.head()
name chr pos status dp low
31 1-3395085-C-T 1 3395085 T 88 0
32 1-16202978-G-A 1 16202978 T 162 0
5 1-11826252-C-T 1 11826252 T 296 0
33 1-17257079-G-A 1 17257079 T 288 1
71 1-33318561-T-C 1 33318561 T 10 0
第二个 DB 只是带有要传递给 geom_rect 的间隔的 DB:
df_int
chr starts ends
0 1 0 5
1 2 5 10
2 3 10 16
3 4 16 19
4 5 19 24
5 6 24 31
6 7 31 36
7 8 36 40
8 9 40 42
9 10 42 45
10 11 45 50
11 12 50 54
12 13 54 55
13 14 55 62
14 15 62 64
15 16 64 67
16 17 67 74
17 18 74 75
18 19 75 82
19 20 82 85
20 22 85 88
21 30 88 92
并尝试将它们组合在一个情节中:
pp2 = ggplot2.ggplot(r_df_int) + \
ggplot2.geom_rect( ggplot2.aes_string(xmin = 'starts', xmax = 'ends', ymin = '0', ymax = '5', fill = 'factor(chr)'), alpha=0.5 ) + \
ggplot2.geom_point( data = r_df1, ggplot2.aes_string(x='sort(order(pos))', y='log(dp)', col='factor(chr)', size='dp', shape = 'factor(low)') ) + \
ggplot2.theme_minimal()
pp2.plot()
File "<stdin>", line 3
SyntaxError: positional argument follows keyword argument
只有一个就可以了。
有人知道吗?
【问题讨论】:
-
完整的错误信息应该比这更长,这里没有显示的内容很可能包含有关问题根源的重要信息。
-
编辑了更多信息,错误很短,我把整行放在那里。提前非常感谢