Most voted "ggplot2" questions
ggplot2 is a graphic design package for R based on the principles of "Graph Grammar". It partially replaces the basic Plot of R and the Lattice package, offering a clean and powerful API. It is written and actively maintained by Hadley Wickham.
Learn more…279 questions
Sort by count of
-
0
votes0
answers10
viewsHow do I adjust the origin of the axes (x,y) to the points (0,0) using ggplot in Rstudio?
PLOT: VARIATION OF VISCOSITY Visc_M5 <- read.csv("VISCOSIDADE.csv", header = T, sep = ";") g1 <- ggplot(Visc_M5) + aes(x=Uexp)+ geom_line(aes(y=Pexp, col = "Experimental"), size = 1.1) Visc2…
-
0
votes1
answer62
viewsMake a graph in R (ggplot) similar to Excel bar charts
How can I make a chart in R (ggplot) similar to this excel chart? I have a table in form csv with this data. I got up to the R this table, but now I don’t know how to make this graph using the R.…
-
0
votes1
answer54
viewsPlot of the CL50 Curve in R using ggplot2 with estimates obtained in Stan
I am trying to make the following graph below in ggplot2. Note that I am adjusting a logistic regression model under the Bayesian approach using the Stan package. dice:…
-
0
votes1
answer84
viewsAdjusted line of the binomial regression model made in ggplot2
I am trying to adjust the line of the binomial model in the graph of observations, however, one observes a problem in the code. The data is below:…
-
0
votes0
answers34
viewsEditing y axes in ggplot2
How do I edit the y axes according to the value scale of each column? The y-axis on the right is with a range of values well above, and the bars do not appear: Reproductive example…
-
0
votes1
answer69
viewsPlot half-normal chart for mixed models adjusted with nlme package
I’m trying to realize the Plot half-normal chart for a mixed effects model adjusted through function lme package nlme. Dice:…
-
0
votes1
answer43
viewsContinuous time data in R
I’ve put together a dataset of covid-19 cases per monthly death, but I can’t plot the results. Does anyone know a more elegant or correct way to do this? I processed the database, and at the end…
-
0
votes1
answer32
viewsHow to change the position of bars/columns and how to place caption
ggplot(data = dados, aes(x = Meses,y = T.max, width = 777600))+ geom_bar(aes(y = T.max), fill="red", stat = "identity",position = "dodge" ) + geom_bar(aes(y = T.med), fill="blue", stat =…
-
0
votes1
answer22
viewsHow to use graphs built by the ggplot function on a Shiny DASHBOARD
I have some graphics ready generated by the ggplot package and am trying to build a Rdashboard Shiny and take advantage of these visual products. However, it is being much more complicated than I…
-
0
votes1
answer29
viewsProblems with predictions using Predict.Gam() and geom_smooth(method="Gam")
Hello, I’m having trouble reproducing the predicted values, using ggplot()+geom_smooth(method="gam"), when I run the command for the graph, it plots a line of prediction, y~s(x,bs="cs") that I can’t…
-
0
votes1
answer33
viewsHow to remove cluster data in the ggplot?
I have the data set below, where I plot the values on a date axis, as there can be equal dates in the database, by default ggplot does the grouping of this data, but the correct visualization would…
-
0
votes1
answer30
viewsHow to arrange the order of the wrong captions using ggplot2 in R
I’m trying to generate a graph of 19-station IQA monitoring stations. But when I graph the order of the groups are wrong, because they are like this: 1, 10, 11 , 12, 13, 14, 15, 16, 17,18, 19, 2, 3,…
-
0
votes1
answer30
viewsHiding values from the chart
I would like to leave plotted in the graph below only the values referring to the months of JAN and FEV of the x-axis. The idea is to keep every month of the X-axis evident in the graph and over…
-
0
votes1
answer33
viewsPlot multiple columns at the same time
I need to plot all columns of a table relative to a specific column. Dataset: df <- read.table( text = "c1 c2 c3 x 2 4 5 0 3 5 2 0 6 7 8 0 1 2 5 1 2 5 6 1 3 3 3 1", header = TRUE) I need to plot…
-
0
votes1
answer71
viewsChanging chart data label
I would like to leave the bar data label of graph "1" equal to graph 2, removing the background color from the label and coloring the numbers. I’m using the argument geom_label on both charts, but…
-
0
votes0
answers21
viewsAdd filter in ggplot2
Is it possible to add selectInput to ggplot2? My idea would be to filter by ano the billing of the technicians so that the graph would not be the way it is, what dexaria more organized when…
-
0
votes1
answer37
viewsHow to change the order of the ggplot2 bar graph?
I’m trying to change the order of the bars so that they appear in the same order as in fill (from top to bottom: a, b, c). df3<-data.frame(Locus =rep(c("gene1","gene2"), 3), variable = c("a",…
-
0
votes1
answer36
viewsHow to layer in ggplot2 with two graphs of different quantities?
I’m starting with programming and I’m trying to plot a graph overlaying data extracted from two dataframes. The code is as follows:: #Real Gross Domestic Product - GDP USgdp <-…
-
-1
votes1
answer32
viewsHow to paint a graph in r from a specific value?
x <- seq(0, 15, length.out=10000) dat <- data.frame(x=x, px=dexp(x, rate = 1/5 )) library(ggplot2) ggplot(dat, aes(x=x, y=px)) + geom_line() I’d like to paint this chart from the value 10,…
-
-1
votes2
answers39
viewsHow to sort my bar chart per day of the week on R
Hello, Good afternoon. I need a help to sort by day of the week on R my bar chart, as below: The code I used is as follows:: date_manip %>% na.omit() %>% ggplot(aes(x=Dia_week), group=1) +…
-
-1
votes1
answer397
viewsHow to create charts using time series showing every month on the x-axis in R?
Suppose I have the following time series: PREVISAO_VL_TR = ts(PREVISAO_VL_TR, start = c(2019,1), end = c(2019,12), frequency = 12 ) And that now I would like to create a chart of this time series:…
-
-1
votes1
answer338
viewsChange plotting order of an area chart in R
I am using the following code to try to plot a graph ggplot(final2, aes(x = final2$a, y =final2$somaacumulada,fill=final2$Country)) + theme_bw()+ geom_area(position = position_dodge(width = 0.8))…
-
-1
votes2
answers38
viewsReorder Columns in graph made by ggplot
I’m producing a bar chart, but the ggplot places the bars in alphabetical order. I need the bars to appear with the names in the order I define. How should I do? Dice nif <- structure(list(Genes…
-
-1
votes1
answer54
viewsHow to annotate an individual chart using facet_grid?
I’m using the function annotate to try to number a figure with facet_grid, but the number goes on the two axes y. How do I write on only one side? https://1drv.ms/x/s! Avi1orbh4c0tjiyruc0ouxkny5fg?…
-
-1
votes1
answer37
viewsHow to obtain bordering municipalities from a geom_sf + ggplot
library(tidyverse) library(geobr) Suppose I’m working with a Conservation Unit. Catimbau National Park (PE), for example. Low data by package geobr ucs<-read_conservation_units() parna_catimbau…
-
-2
votes1
answer43
viewsHow to eliminate Labels and x-axis on an inverted bar chart?
I’d like to know how to delete Labels and the X axis line from the following inverted bar graph. . Because I think you have redundant information. dice Hi Lucas, thanks for the reply. Follow the…
-
-2
votes1
answer46
viewsHide part of a chart caption
I have a chart made with ggplot2, in the legend is appearing a size and I’d like to remove it, but I don’t know how. My code: updates %>% mutate(mortalidade = deaths / confirmed) %>%…
-
-2
votes1
answer55
viewsHow to plot Pcoa/MDS?
I’m trying to plot Pcoa, but the chart is coming out pretty slick. Before the Pcoa I did PERMANOVA using data of importance of 10 species of coastal vegetation as a function of 5 different…
-
-3
votes1
answer37
viewsHow to edit the following bar graph in R?
I would like to understand how I can make the following changes to the chart below: Change the Y-axis scale and hide it from the graph if you want Place values on top of each bar Place the X-axis…