Questions tagged as 'ggplot2'

1
answer

How to put legend in distributions graphs in ggplot

I have the following graph of the exponential distribution, I want to put a caption showing the parameter of my exponential. ggplot(data.frame(x=c(0,5)),aes(x))+ stat_function(fun=dexp,colour='red',size=1.4)+ stat_function(fun=dexp,args=li...
asked by 23.11.2014 / 01:29
1
answer

Sort of dates ggplot2

Hello, this is my first question in this% s% s and I have not mastered it yet.  I'm learning this wonderful language and now I'm having serious problems plotting a graph using the R package, the data is dates and they do not follow the natural...
asked by 20.02.2018 / 13:02
2
answers

How can I get the maximum and minimum values after applying LOESS

My data is brought from a database and I simply apply: ggplot (data = df_postgres, aes (x = date_time, y = duracao)) + geom_point() + stat_smooth(method = "loess") And I get the following smoothing: Is it possible to get the maxim...
asked by 15.09.2015 / 15:17
1
answer

Automatically identify points of influence in a regression

Whenever we do a linear regression, we need to check whether the assumed assumptions for the model are correct. One of the best ways to do this is through diagnostic charts. See the example below: ajuste <- lm(Petal.Width ~ Petal.Length, da...
asked by 27.10.2017 / 14:27
1
answer

Bar chart sorted using dplyr and ggplot2

I'd like to create a bar chart after counting the number of occurrences of categories in a dataset. Suppose my dataset is this below: dados <- structure(list(categorias = structure(c(5L, 4L, 5L, 3L, 1L, 2L, 5L, 3L, 1L, 1L, 4L, 4L, 1L, 5L,...
asked by 28.06.2017 / 18:46
1
answer

How to plot a line chart with different colors depending on the value?

Suppose the following data: set.seed(1) y<-rnorm(101) x<-seq(from=0, to=100,by=1) I want to make a plot with a line that has a different color for negative values. To make a point graph, simply use the command below: plot(x,y,col...
asked by 19.03.2014 / 17:49
1
answer

color gradient R

How do I change the color of the graph in a gradient way with the variable years, starting from white to intense red. colourCount = length(unique(tabela.estacao$ano)) getPalette = colorRampPalette(brewer.pal(9,"Reds")) ggplot(tabela.estacao,...
asked by 13.10.2016 / 15:00
2
answers

Color scale adjustment in R

Good afternoon, I created a bar chart using a gauge to fill in the colors of the bars, where the nearest to red is bad, and the closer to green is good. It turns out that he adjusted according to the data, so the number 29 turned green when i...
asked by 16.11.2018 / 20:31
2
answers

Overlay graphics in R with ggplot

Hello, consider two data frames: df = the number of students who answered items A, B, C, D and E of a 6-question test ITENS <-c("A","B","C","D","E") Q.1 <-c(10,20,10,40,10) Q.2 <-c(5,25,0,50,10) Q.3 <-c(15,20,5,40,10) Q.4 &...
asked by 10.05.2018 / 16:01
2
answers

Scatter plots fixing a response variable

Suppose I have an interest in the iris dataset, already present in R memory: head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9...
asked by 01.06.2017 / 14:21