我正在努力制作一个绘图,它将来自两个不同df的数据组合在ggplot2 form rpy2中。你知道吗
我不能让它工作,就像每次只能用一个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
第二个分贝就是分贝,间隔传递给几何体:
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
只有一个就行了。你知道吗
有人有线索吗?你知道吗
正如错误消息所指出的,这个错误在上一个表达式的第三行,是关于Python不允许在调用中的命名参数之后使用未命名参数(可以使用R,而不是Python)。你知道吗
将
data=r_df1
移到aes_string
之后,或者为第二个参数命名:相关问题 更多 >
编程相关推荐