Questions tagged as 'ggplot2'

1
answer

Text Position in pie chart in ggplot2

I have the following table Var1 Freq Percentual Até 50 anos 4657 2.98% De 51 a 60 anos 32009 20.47% De 61 a 70 anos 57368 36.68% De 71 a 80 anos 46075 29.46% Mais de 80 anos 16299...
asked by 06.07.2017 / 15:34
1
answer

3D Histogram using ggplot2

I have data from a two-dimensional distribution, for example, uniform. I want to make a histogram with this data. I tried the package plot3D , but it was not very cool. teste = matrix(runif(100), ncol = 10) plot3D::hist3D(z = teste, bt...
asked by 13.06.2016 / 22:11
1
answer

Change the order of the facet_wrap in ggplot2

See the code below, which generates the following graph: library(lme4) library(ggplot2) ggplot(sleepstudy, aes(x=Days, y=Reaction)) + geom_point() + geom_smooth(method = "lm", se=FALSE, color="black") + facet_wrap(~ Subject, nrow=3)...
asked by 15.09.2016 / 19:52
3
answers

How to put the regression line on a graph?

Suppose a linear regression model such as the following: set.seed(1) x <- rnorm(100) y <- rnorm(100) + 2*x +10 modelo <- lm(y~x) If I plot y against x, how do I include the regression line in the chart? plot(y~x)     
asked by 18.02.2014 / 14:50
3
answers

How to put separate ggplot2 graphics, but on the same screen?

Suppose I have these 4 graphics: p1 <- ggplot(mtcars, aes(mpg, cyl)) + geom_point() p2 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line() p3 <- ggplot(mtcars, aes(mpg, cyl)) + geom_line(color="blue") p4 <- ggplot(mtcars, aes(mpg, cyl))...
asked by 26.09.2014 / 02:29
2
answers

How to smooth a curve and define ylim for a given function using ggplot2?

I got the following graph with the curve function: f1 <- function(x){x^4 - 6*(x^2)} curve(f1, xlim = c(-3, 3), ylim= c(-10, 5), ylab = expression(x^4 - 6*(x^2))) However, I would like to use the ggplot2 package to reproduce this same gra...
asked by 18.03.2015 / 20:23
1
answer

bar graph ggplot 2 side-by-side vectors

Can anyone tell me if it's possible to make this chart with the bars side by side without using data frames or "melt"? v1=c(100,120,140) v2=c(125, 102,104) a=data.frame(year=factor(2003:2005)) ggplot(data=a, aes(x=year)) + geom_bar(aes(y =...
asked by 31.10.2018 / 20:19
1
answer

Problem using ggplot by group

This is my dataframe: structure(list(ind = structure(c(177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L, 177L,...
asked by 16.09.2018 / 05:25
2
answers

How to add space in boxplot and center the median

I would like to make two changes to the following chart :Leaveasmallspacebetweenthegreen(F)boxplotandorange(s)Placethemedianpointinthecenterofeachboxplot(pointsareappearingattheendoftheboxplotandwhenthetwoplotshavethesamemedianvalue,onlyonep...
asked by 29.05.2018 / 17:39
1
answer

How to plot the estimated logistic regression model

Suppose I have the data below, apply a logistic regression on them and want to see the estimated function that returns the probability. #Simula os dados nobs<-100 beta0=-10 beta1=0.006 saldo=runif(nobs,1300,2300) p_x <- exp(beta0 + beta1...
asked by 19.02.2014 / 13:29