我正在寻找使用Pythonmedian_area绘制disturbance_code2020 年以下数据框的图。ggplotscenario | year | disturbance_code | median_area------------------------------------------------Base | 2020 | 1001 | 14264Base | 2020 | 1002 | 6637Base | 2020 | 1003 | 18190Base | 2021 | 1001 | 15000Base | 2021 | 1002 | 3615Base | 2021 | 1003 | 3132我的代码非常简单:import pandas as pdimport numpy as npfrom ggplot import *data # this is the dataframe above - it comes from elsewhere in my actual codeggplot(aes(x = 'disturbance_code', y = 'median_area', fill = 'scenario'), data = data_frame[data_frame['year'] == int(2020)]) +\ theme_bw() +\ geom_bar(stat = 'identity', position = 'dodge') +\ labs(x = 'Severity', y = 'Area burned (ha)')这给出了以下情节:然而,非常奇怪的是,简单替换geom_bar()withgeom_line会得到:
添加回答
举报
0/150
提交
取消