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

How to use R language to realize data Visualization drawing bar chart Bar Chart

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "how to use R language to achieve data visualization drawing bar chart bar chart", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use R language to achieve data visualization drawing bar chart bar chart" this article.

Suppose Xiao Xian is going to help a bookstore graphically show the most popular ones in 2018.

Bibliography, the data is shown below.

The bar chart looks good, but it is different from what Xiao Xian imagined. It is clear that my data are arranged according to sales volume from high to low, why are they drawn in alphabetical order?

After using the function reorder (), which sorts factors, it looks like the following figure, which is still different from what you imagined.

After searching the tutorials on the Internet for a long time, we did not find a simple way to sort the factors in descending order, so Xiao Xian boldly added a minus sign in front of the sorting vector parameters, but did not report a successful error. Unexpected surprise (sometimes bold attempts will also have surprises, oh, to find tutorials online, you have to understand other people's code first, and sometimes you find that reading for a long time does not help you).

The specific drawing process is as follows.

Step1. Preparation of drawing data

First of all, you should adjust the data you want to draw into a format that can be recognized by the R language and save it in excel to csv format.

Step2. Reading data of drawing 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

Development

Wechat

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

12
Report