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.
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 debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am using plot() for some raster images. I want to increase the size of the legend scale tick labels. Any ideas?
Following the documentation for raster::plot(), any extra parameters passed to it are passed to fields::image.plot(). See: image.plot
Based on the answer to this: Increase font size in legend of image.plot, you should be able to pass
axis.args = list(cex.axis = font_size)
as a parameter to your call to plot() to change the legend tick label size.
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)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I had a question on how to change/customize the upper and lower limit of a notch on a boxplot created by ggplot2. I looked through the function stat_boxplot and found that ggplot calculates the notch limits with the equation median +/- 1.58 * iqr / sqrt(n). However instead of that equation I wanted to change it with my own set of upper and lower notch limits.
My data has 4 factors and for each factor I calculated the median and did a bootstrap to get a 95% confidence interval of that median. Thus in the end I would like to change every boxplot to have its own unique notch upper and lower limit.
I'm not sure if this is even possible in ggplot and was wondering if people have an idea on how to do this?
Thanks again!
I've figured out one way to customize the notches on a plot using ggplot with the function ggplot_build.
After plotting a boxplot with say:
p<-ggplot(combined,aes(x=foo,y=bar)) + geom_boxplot(notch=TRUE)
not really sure what exactly happens with ggplot_build but seems like it converts the plot into a data-frame ish structure so one can manipulate it if wanted.
gg<-ggplot_build(p)
afterwards:
gg$data[[1]]$notchlower
gg$data[[1]]$notchupper
contains the notch limits for your plot and you can basically change it with something like:
gg$data[[1]]$notchlower<-50
gg$data[[1]]$notchupper<-100
And if you had mulitple boxplots and wanted to individually change each boxplot:
gg$data[[1]]$notchlower[1]<-50
gg$data[[1]]$notchlower[2]<-50
....
gg$data[[1]]$notchlower[n]<-50
gg$data[[1]]$notchupper[1]<-100
gg$data[[1]]$notchupper[2]<-100
....
gg$data[[1]]$notchupper[n]<-100
Anyways hopefully this is a valid method to do and it would be of help for other people.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I plot two hexbin graphs with R (with package 'hexbin') from data file with two columns gr and ug.
The first plot : gr as a function of ug
The second plot : ug as a fonction of gr
Why aren't they perfectly symmetrical?
Thanks in advance
Notice that in both cases the hexagons are oriented to have 2 sides vertical and no sides horizontal. To be perfectly symmetric one of the plots would need to have the rotated hexagons (2 sides horizontal).
So the binning is slightly different between the 2 graphs and points that are near the boundary in the 1st plot may fall into a different cell (symmetrically) in the 2nd plot. So while the 2 plots are similar overall you will see some minor differences due to how the data is binned.
This is true in general for plots/techniques that depend on binning continuous data, a slight change to how the binning is done will results in usually minor changes in the results. It is good to do multiple plots with small changes to the options that determine the binning to see how much things change.