Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Realization of text Cloud by Visualization of R language Information

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "R language information visualization to achieve text cloud". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. let's study and learn "R language information visualization to realize text cloud".

R language can easily deal with information visualization, and there is a special information visualization package-WordCloud for a long time.

But this first version of the text cloud tool, really super bad, not only many parameters, but also the rendering effect is bad, can not customize the shape, the color is not easy to match.

Today's protagonist is WordCloud2, an updated version of the package (although I don't know if the two packages were developed by the same author).

R language configuration environment:

R x64 3.31/Rstudio 0.99.903/wordcloud2 0.2.0

Load character cloud package:

Library (wordcloud2)

The essence of grammar:

Wordcloud2 (data, size = 1, minSize = 0, gridSize = 0

FontFamily = NULL, fontWeight = 'normal'

Color = 'random-dark', backgroundColor = "white"

MinRotation =-pi/4, maxRotation = pi/4, rotateRatio = 0.4

Shape = 'circle', ellipticity = 0.65, widgetsize = NULL)

(1) data: word cloud generation data, including specific words and frequency

(2) size: font size. Default is 1. Generally speaking, the smaller the value is, the more obvious the outline of the shape will be.

(3) fontFamily: font, such as' Microsoft Yahei'

(4) fontWeight: font weight, including 'normal','bold'' and '600'

(5) color: font color. You can choose 'random-dark'' and 'random-light',', which is actually the color system.

(6) backgroundColor: background color, which supports common colors in R language, such as' gray','blcak', but does not support more specific color choices, such as' gray20'.

(7) minRontatin and maxRontatin: the minimum and maximum values of the rotation angle range of the font. When selected, the word will rotate randomly within this range.

(8) rotationRation: font rotation ratio. If set to 1, all words will rotate.

(9) shape: select the shape of the word cloud. The default is' circle', which means circle. You can also choose 'cardioid' (apple or heart),' star' (star), 'diamond' (diamond),' triangle-forward' (triangle), 'triangle' (triangle),' pentagon' (Pentagon)

Import data:

Data

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report