Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to create a pie chart superimposing multiple variables using r-plotly.
For instance, I have values for the global population of a country, it's economically active population, and the economically active male/female.
I want to get all those data inside a single pie chart, with the full cercle as the golbal population, a part of this cercle representing the active population, which is divided itslef in 2 parts, male/female.
I unfortunnatly have no idea how to archieve it and I don't even know is it's possible.
I didn't manage to do it using the function :
plot_ly(...)
Thank you for your help and happy new year !
I think a "sunburst" plot could be what you are looking for.
Here is an example on a fake dataset:
library(sunburstR)
dat <- data.frame(G = c("male-active", "male-inactive", "female-active", "female-inactive"),
N = c(100, 100, 100, 100))
sunburst(dat)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 months ago.
Improve this question
I have 3 dimensional data and need to plot this data in two ways.
The first one should look like this:
And the second one like this:
where the given data is more like the second plot.
I do know that both plots have completely different styles and therefore it seems not likely to create it in the same way. Right now I am working with R and Im familiar with packages like ggplot2, plotly or rayshader. But I'm not very familiar with creating more aesthetic and less scientific plots like displayed above. Especially the second one seems beyond the capabilities of R.
I would be very grateful if you could give me tips on how to plot 3-dimensional data in this way. Not necessarily by using R.
Thanks!
The second plot type is straightforward in base R:
par(bg = 'black')
par(mar = c(0, 0, 0, 0))
persp(volcano, box = FALSE, col = 'black', border = 'gray90',
theta = 45)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have two shapefiles of the state of NSW, Australia. The first one has some regions that are useful for economic reasons, while the second has information about the koala population, in much smaller polygons.
Here I show both maps that I get when I plot these shapefiles:
Areas of NSW
Probability of finding a Koala
What I'm attempting to do is to add the region name of the first picture to each of the quadrants of the second file.
Is this possible? Which would be a method to match the polygons of both files? Thanks
You are likely looking for sf::st_join().
What it does is it transfers the non-spatial information from one {sf} object to another based on spatial relation. For the function to work both spatial objects need to have the same CRS (so consider sf::st_transform() if they do not).
Note that the order matters: you either add koala info to administrative areas, or area info to koala regions.
Also note that some koala regions are likely to straddle the border of two regions; these will be split. So expect slightly more rows coming out that what went in.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Does anyone know how I can remove the curved frame line and only leave the dots in the violin plot when using geom_violin function? As shown in the graph below
first I think that doesn't make sense you remove the shape because it is really helpfull to visualize the distribution of the variable.
But, if you really want it, you have to use geom_dotplot() insted of geom_violin().
Your code could be like this:
ggplot(mtcars, aes(factor(vs), drat)) +
geom_dotplot(binaxis ="y", stackdir = "center")
Then, your result is gonna be:
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
What's the meaning of beautiful chart for humans and which theme or color gradients should use, so everybody could say, visually beautiful color and harmony used for the specific chart. Especially, I want to tune colors, labels, etc. in R histogram to gain full mark in my homework. Any help would be appreciated.
You can use this code to have a beautiful histogram
col <- c("#B2182B", "#D6604D", "#F4A582" ,"#FDDBC7", "#D1E5F0", "#92C5DE", "#4393C3" ,"#2166AC")
hist(precip,breaks = 13,col=cm.colors(5),freq =F,xlab = "xlab",ylab = "ylab",main = "main")
your output be something like this :
or this one to have more colorful plot
hist(precip,breaks = 13,col=rainbow(13),freq =F,xlab = "xlab",ylab = "ylab",main = "main")
your output be something like this :
for more details about the attribute of hist function you can look at this link:
https://www.rdocumentation.org/packages/graphics/versions/3.5.3/topics/hist
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Each time I encounter a new plotting function in Base R (e.g., dotchart(), smoothScatter(). matplot()), I wish there was a list of plotting functions in Base R which I could refer to for various plotting cases.
Question:
I was wondering if any our colleagues might be aware of a list of plotting functions in Base R which I could refer to for various plotting cases?
You could use
library(help = "graphics")
that will display the list of plotting functions e.g.:
...
barplot Bar Plots
box Draw a Box around a Plot
boxplot Box Plots
boxplot.matrix Draw a Boxplot for each Column (Row) of a
Matrix
bxp Draw Box Plots from Summaries
cdplot Conditional Density Plots
clip Set Clipping Region
contour Display Contours
coplot Conditioning Plots
I found this site R plot gallery that has a wide array of basic types. Click on them to see the numerous variants and the function call for each.