我在使用python plotnine ggplot库绘制lineplot时遇到问题。 我尝试了geom_point和geom_line,只有geom_line有问题。
final_result = [['head', 'male', 11.880583171300556],
['head', 'female', 9.181195949641543],
['neck', 'male', 18.288218605326048],
['neck', 'female', 15.433385591728676],
['body_top_shoulder', 'male', 45.77760065998323],
['body_top_shoulder', 'female', 42.10334644289686],
['body_top_chest', 'male', 56.85636914401857],
['body_top_chest', 'female', 52.15933846772258],
['body_bottom_waist', 'male', 54.095350745146995],
['body_bottom_waist', 'female', 53.50202259687758],
['body_bottom_stomach', 'male', 47.01293142732554],
['body_bottom_stomach', 'female', 45.1689572636577],
['leg', 'male', 28.401324830736257],
['leg', 'female', 27.098990036947185],
['foot', 'male', 44.07241779487932],
['foot', 'female', 43.98427730736562],
['arm', 'male', 34.73054349834513],
['arm', 'female', 34.12618814855175],
['hand', 'male', 45.986212053884465],
['hand', 'female', 44.406541536658914]]
result_data = pd.DataFrame(final_result, columns=['part', 'gender', 'RMSE'])
(ggplot(result_data, aes(x='part', y='RMSE', color='gender'))
+ geom_point()
+ geom_line()
+ theme(text=element_text(family='LG PC'),
axis_text_x=element_text(size=10, angle = 90, vjust=1))
)
结果,geom_point()可以工作,但是geom_line没有出现。问题出在哪里?