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 > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "R language visualization to achieve chart nesting". In daily operation, I believe that many people have doubts about the realization of chart nesting in R language visualization. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "R language visualization to realize chart nesting"! Next, please follow the editor to study!
There has always been a confusion when I was learning ggplot.
This is whether this function allows two related charts to overlap and nest (that is, to place a smaller version of a smaller image at the edge of a large image (main image)).
It was a strange idea, and I thought it was hopeless, and given the sharp aesthetics of the developer of the package, I guess it can't be allowed to happen.
However, recently, I visited a great god's blog and found a solution to this situation. I was overjoyed and hastened to share it with you here.
However, his approach is not through the built-in function of ggplot, but through the viewport function in the grid package:
The following are the specific implementation steps:
Load package:
Library (ggplot2) # is used for drawing, and both the main and accompanying drawings use ggplot's built-in dataset
Library (grid) # is used to set the length and width of the attached drawings and to stack them in the exact position of the main drawing.
Load and preview the dataset:
Here we still use the data set about diamonds (this data set is used in many previous chart cases).
Data (diamonds)
Head (diamonds)
# make the main image of the composite image:
Chart1
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.