In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "ggplot2 how to control the position of the text added in the pie chart". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to control the position of text added in the pie chart by ggplot2".
The explanation of pie chart mainly explains the formula of adding text in the picture. Here, combined with the content of stacked bar chart, the formula is not used, but geom_bar (position) geom_text (postion) is used to control the adding process of pie chart text.
For example:
Type=c ("A", "B", "C", "D", "E") Num=c (90Med 34, 56, 9915) dat=data.frame (type,Num) datdat$type=factor (dat$type,levels = dat$type,order=T) dat$typep_pie=ggplot (dat,aes (x = ", y=dat [, 2], fill=dat [, 1])) + geom_bar (stat=" identity ", width=1,position = position_stack (reverse = T) p_pie
Polar coordinate transformation and color settings
Pendant PiezePiezie + coord_polar (theta= "y", direction=1) pairpiepsilpiepiezie+ scale_fill_brewer (palette = "Set3", direction=1) + labs (x = "", y = ", fill=" Type ") + ggtitle (label =" test ", subtitle=NULL) p_pie
Control geom_text (position)
Thank you for your reading. The above is the content of "how ggplot2 controls the position of adding text in the pie chart". After the study of this article, I believe you have a deeper understanding of how to control the position of text in the pie chart by ggplot2. I believe you have a deeper understanding of how to control the position of text in the pie chart. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.