Category "ggplot2"

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

Creating predicted vs observed confidence interval graph

Hello and thank you for you time and consideration, I'd like to recreate this graph with ggplot. The top blue dots are the predicted values from my fitted model

possible to have separate factor levels for each axis in one graph?

I'm trying to plot a Sankey diagram of financial flows between a source country and counterpart country. ggplot(dat_ggforce, aes(x=x, id=id, split = y, value=yv

Add unique horizontal line for levels in facet_grid

I want to add a unique horizontal line across each row of a set of facet grid boxplots. x<-c("species_X","species_X","species_X", "species_Y","species_Y",

Arranging bars in multi-panel Lollipop chart using ggplot2

I am trying to plot a multi-panel Lollipop chart using ggplot2 using the following code #Data df =structure(list(Indices = c("Time", "Z11", "Z51", "Z61", "Z161"

ggplot2 geom_point position= "dodges" doesn't match the error bar dodge

Im trying to figure out the best way to plot changes in water potential through summer comparing two factors, soil cover treatments and irrigation. I reached a

Fitting a line to the mean values of a multilevel variable using geom_smooth

I have this dataframe. I create a plot representing on the y-axis "value" and on the x-axis each of the levels of "Column_S", which contains levels from S1 to S

How can I add a legend for error bars in ggplot?

I have been trying to amend what I thought was a straightforward legend on my GGPlot for a day now and not making much progress (I have searched extensively on

How to look at differences between 2 columns in R

I just need to write some code that will look at the difference between the "est_age" and "known_age" columns in my data set. Then I need to know what percenta