geom_wordcloud:这是一个管道梦 [英] geom_wordcloud : is this a pipe dream
问题描述
我用各种分组变量处理文本数据。我正在考虑使用Ian Fellows的 wordcloud
软件包创建一个方法来创建多面的wordcloud图。我喜欢 ggplot2
方面社交变量的方式。我正在决定如何解决这个问题(多面wordcloud阴谋)。
是否有可能将Fellows的工作用作geom(我从来没有做过geom,但可能会了解这是否可行)或ggplot不会很好地发挥,因为一个是网格,一个是基础(wordcloud也使用一些C编码)或其他一些问题?这是多么困难(我知道这取决于我的能力,但想要一些球场答案)?请告知如果使用基本图形可能是解决此问题的更明智的方法。我预见这可能会使用 plotrix
包中的窗格
来处理,从而赋予它ggplot的刻面赋予的美感。 / p>
也许这是一个愚蠢的概念,考虑到词云的大小以及快速限制可用空间的方式。
>解决方案这可能是一个梦想,它肯定不容易重复使用 wordcloud
代码:
- 正如Ian Fellows在评论中指出的那样,
wordcloud
代码计算字的大小和位置图形。 - 对代码进行geom-aware修改需要注意facet。
为了使其工作,设计解决方案的框架可能是:
- 重写
wordcloud
计算网格图形中的字符大小,而不是基本图形
- 将字符大小和位置的结果写入数据框
- 将计算封装在名为
stat_wordcloud
- 修改
geom_text $ < c $ c>添加到新的
geom_wordcloud
,但是一旦你做到了,我会热衷于使用它; - )
I deal a bit with textual data across various grouping variables. I'm thinking of creating a method to make faceted wordcloud plots using Ian Fellows' wordcloud
package. I like the way ggplot2
facets social variables. I'm deciding how to approach this problem (faceted wordcloud plot).
Is it possible to use Fellows' work as a geom (I've never made a geom but may learn if this is doable) or will ggplot not play nicely because one is grid and one is base (and wordcloud also uses some C coding) or some other problem? How difficult is this (I know this is dependent on my abilities but would like some ball park answer)? Please advise if using base graphics may be the more sensible approach to this problem. I foresee this may be approached using panes
from the plotrix
package to give it the aesthetic feel that ggplot's faceting gives.
Maybe this is a foolish concept considering the size of word clouds and the way faceting quickly limits the available space.
This may be a pipe dream, and it certainly isn't easy to re-use the wordcloud
code:
- As Ian Fellows points out in a comment, the
wordcloud
code calculates word sizes and positions in base graphics. - A geom-aware modification of the code needs to be aware of facets.
In terms of making it work, a framework for designing a solution might be:
- Rewrite
wordcloud
to calculate word sizes in grid graphics, rather than base graphics - Write the results of word size and position to a data frame
- Wrap the calculations in a function called
stat_wordcloud
- Modify
geom_text
to a newgeom_wordcloud
So, it's a pipe dream, but I'd be keen to use it once you've made it ;-)
这篇关于geom_wordcloud:这是一个管道梦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!