Category "ggplot2"

Set panel label size in R::multipanelfigure

I am creating a multi panel figure that includes a ComplexHeatmap object so I am using multi_panel_figure() instead of ggarrange(). I have tried to include an

R - Correlation heatmap created with ggplot2: How can I flip the labels on the y-axis?

I found this easy way to create a correlation heatmap using ggplot2: data(attitude) library(ggplot2) library(reshape2) ggplot(melt(cor(attitude)), aes(Var1,

How to add Latex code in ggplot2 legend labels?

Consider the following example: p <- ggplot(data = data.frame(A=c(1,2,3,4,5,6,7,8),B=c(4,1,2,1,3,2,4,1),C=c("A","B","A","B","A","B","A","B"))) p <- p + g

ggplot2: how to color a graph by multiple variables

I am fairly certain I have seen a solution for this somewhere, but as I have been unable to find it, here is my problem. I have some time series data identifi

plot this in ggplot. Controlling y axis line within a range

This is using base, where I can control the x and y axis range, where exactly the line should be drawn. plot(mtcars$mpg, mtcars$hp, ylim = c(0, 400), xlim = c(

R- How to set y-axis individually when using `facet_grid_sc()`

I want to plot the trend of the density (Density.est) of 3 species (Emar,Ecos and Sphyr) over time (2008,2009,2010) for two protection levels of a protected are

where and how to apply a filter in a ggplot

I have a set of data called 'theatres' I have prepared a box plot of all the data with this code: There is a column in the data called 'sector' and the data w

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer. I would like them to be displayed in th

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer. I would like them to be displayed in th

How to create a stand alone legend in R

This is a slightly different but very similar question to How can i create a legend without a plot in r but differs in that I do not want to use the -pch- optio

Adjusting white space between titles and the edge of the plot

I want to create space between the titles (the axis title and the plot title) and the edge of the plot. I tried vjust on axis.title and plot.title with no luck.

Relative frequency histogram in R, ggplot

I can draw relative frequency histogram in R, using lattice package: a <- runif(100) library(lattice) histogram(a) I want to get the same graph in ggplot.

Grouped bar plot in ggplot

I have a survey file in which row are observation and column question. Here are some fake data they look like: People,Food,Music,People P1,Very Bad,Bad,Good P

ggplot2: fill color behaviour of geom_ribbon

I am trying to colour ribbons in ggplot2. When using geom_ribbon, I am able to specify ymin and ymax and a fill color. What it now does is coloring everything t