Category "ggplot2"

In R - How do I plot the data from the row where the date=='"2020 Q1' to the last row of the dataframe?

example of the data: Date Inflation 2020 Q1 2 2020 Q2 2.1 2020 Q3 2 2020 Q4 2.1 I am using ggplot ggplot(CPI,aes(x=date,y=inflation,group=1))+geom_line() but

How to change tickmode for all subplots of facet_grid

I want to change the tickmode of all xaxis/yaxis in all subplots to "auto" but the number of subplots changes. I tried the following code. It works for the firs

R ggplot with 2 y-axes at different scales

The following is df_sales df_sales <- structure(list(Year_of_Release = c(2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,

Lay out multiple ggplot graphs on a page

I generate a list of ggplot objects inside a loop as follows: myPlots = list() for(i in 1:length(maturities)){ myPlots[[i]] <- ggplot(deltaIR.df, aes(samp

GGPlot, fill by proportion with a geom_col()

I am trying to make each column fill by the proportion of each type of medal (Bronze, Silver, Gold) in relation to the Medal_sum for each country. Olympic_overa

How to one barplot into two within one picture?

This is my code: p14 <- ggplot(plot14, aes(x = Harvest, y = Percentage, fill = factor(Plant, level = orderplants)))+ geom_col(show.legend = FALSE)+ geom_

Create multiplot with map and scatter

I am trying to create multiplot that contains a map (using geom_sf) and a graph next to each other. I tried to use GGpubr::ggarrange and cowplot::plot_grid for

arranging multiple plots with cowplot cuts off statistics

When arranging multiple plots from a plotlist with cowplot, the stat_compare_means values get cut off in the grid (see picture). When I am removing the plots ti

Discriminant Analysis (FDA and MDA) plots in R

I am trying to plot the results of Flexible discriminant analysis(FDA) and Mixture discriminant analysis(MDA) using the mda and ggplot2 package. I did it for Li

Difference in legend position between ggplot and ggplotly?

I find out an interesting and strange difference between the same chart in ggplot and ggplotly income_gap_chart <- ggplot(income_gap, aes(x = Country, y = Pe

ggplot2 : Can't add ` ` to a ggplot object

everyone I generated 2 ggplot figures and I would like now to add them into the same figure, to do that I simply add the +. So I have 2 plots : (1 ggtree and 1

r add math symbol to x axis text

I am trying to add a math symbol (sum) to some texts in x-axis. For example, if this is my plot. data(iris) p1 <- ggplot(iris, aes(x=Species, y=Sepal.Length)

Saving patchwork ggplots with furrr future map only saves one of the plots

I am trying to save a list of patchworked ggplots (ie ggplots that have been wrapped together into 1 plot using the package patchwork). My real data is creating

Plot customised vertical lines up to the curve

I want the vertical lines to not go beyond the curve line after they intersect Example data: x <- 1:50 dat <- data.frame(x = x, y = 1 - exp(-x/43)^4) ggp

How to swap x-axis tick labels with plus/minus signs table

I'm struggling to figure how to change my x-axis label in ggplot2 from regular identifications to not-so-regular plus/minus signs to relate the addition or abse

Trying to bold y axis in ggplot

I am trying to bold my y-axis. The title for the axis is bold, but I can't seem to figure out how to bold the number themselves. Here is my code so far, combi

Equivalent of validation plot in ggplot

I am trying to write the code to plot validationplot {pls}'s equivalent using ggplot. I could make this using base R, but could'nt figure out how to plot thi

Equivalent of validation plot in ggplot

I am trying to write the code to plot validationplot {pls}'s equivalent using ggplot. I could make this using base R, but could'nt figure out how to plot thi

r shiny and ggplot2::facet_wrap how can I add categories to facet_wrap without having the original plot resize?

I have a shiny app that lets the user add categories to the facet_wrap. When I start with one category the plot fills the entire box but when I add a second cat

How to add_trace to a plotly object created from ggplotly in R

I want to be able to add a new line/trace to a plotly object. This plotly object will be created from a ggplot object using ggplotly. I tried 1. creating the pl