R:创建气泡图

时间:2017-10-12 02:33:17

标签: r ggplot2 visualization bubble-chart

我的数据框包含类别,功能和数字。

>fun_category_df

          sec_category                sec_function `Number of Patents`
 1  cleaning apparatus                    cleaning                   2
 2  cleaning apparatus    enhance material removal                   2
 3  cleaning apparatus improve slurry distribution                   2
 4 detecting apparatus    enhance material removal                   6
 5 detecting apparatus          improve uniformity                   6
 6    dresser abrasive    enhance material removal                   5
 7    dresser abrasive   improve process stability                   3
 8    dresser abrasive             improve quality                   2
 9    dresser abrasive          improve uniformity                   9
10   dresser structure          improve uniformity                   3
# ... with 38 more rows

我想基于我的数据框创建一个气泡图。 我尝试过使用ggplot2来创建它。

library(ggplot2)
bubble <- ggplot(fun_category_df, 
                 aes(x =sec_category  , y = sec_function , size = `Number of Patents`)) %>%
          + geom_point() + theme(axis.text.x = element_text(angle = 90, hjust = 1))

enter image description here

但泡泡只有3个尺寸可供展示。

如何按照“专利号”设置气泡抓取?

此外,我还想在每个气泡上标记数字标签。如下例所示。

enter image description here

0 个答案:

没有答案