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

What is the beautification and application of charts in R language visualization

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

What is the beautification and application of charts in R language visualization? in order to solve this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Although the default design style of the chart made by the ggplot function has been carefully crafted by the designer, it is not entirely satisfactory.

After all, in this era when the aesthetic level of the public is getting higher and higher, various reports in enterprises also emphasize the mutual unity with the VI of enterprises to form their own styles and characteristics.

This requires that the charts made by R language can be highly customized according to the desired style and theme. Of course, the ggplot function supports this diversity of customized requirements, even like those well-known consulting or top financial media royal chart templates have been made into chart themes to be shared in the R language theme package.

Next we will introduce some details about the chart theme setting:

On the transformation between column chart and bar chart:

This problem was mentioned yesterday, R language does not distinguish between bar charts and bar charts, both are called Barplot, but the direction of opening is different. (the reason has been explained earlier)

The conversion order between a column chart and a bar chart can be obtained with a single code:

Coord_flip () # flipping between column chart and bar chart

Ggplot (mpg,aes (class,displ)) + geom_bar (stat= "identity", fill= "steelblue")

Ggplot (mpg,aes (class,displ)) + geom_bar (stat= "identity" fill= "steelblue") + coord_flip ()

Column / bar charts are sorted by index order:

By default, the order of the indicators of the column chart is very chaotic, and we can set the parameters to sort the column chart according to the index from high to low or from low to high.

We draw the first 8 records from ggplot's default built-in dataset mtcars:

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