Questions tagged as 'ggplot2'

1
answer

How to reproduce a graph that was created with the plot command using ggplot2?

How to reproduce the graph below using ggplot2 ? I do not know how to add multiple graphs to a single layer ! bs<-function(t,mu,phi){ fdp=((exp(phi/2)*sqrt(phi+1))/(4*sqrt(pi*mu)*t^(3/2)))*(t+((phi*mu)/(phi+1)))* exp((-phi...
asked by 23.03.2017 / 19:02
1
answer

Quadratic Curve Estimation Minima Square using R

I have a quadratic model that I want to run a simple multivariate regression using Minimal Ordinary Squares. This is my code: df<-data.frame(rnorm(50),rnorm(50)) x_Square<-df[,2]^2 data<-cbind(df,x_Square) names(data)<-c("y","x"...
asked by 05.10.2016 / 03:42
3
answers

geom_text by positioning the labels individually

I am making a chart similar to this example, where I position the labels by group: I'musingthecode:set.seed(1000)ano=factor(rep(1996:2016,2))cod=c(rep("K1",21),rep("O1.3",21)) valor=round(c(cumsum(rnorm(21)),cumsum(cumsum(rnorm(21)))),1) dat=d...
asked by 30.11.2018 / 16:23
2
answers

Code for displaying BoxPlot in ggplot2

In the boxplot view created with the script below, I do not think the g2, g3 and g4 graphics are the same ones that appear in the g1 image, but I could not find anything wrong with the code! Notice that the median or maximum...
asked by 02.03.2017 / 18:31
3
answers

How to put several formats in the points of my PCA by ggplot2

I would like to put different shapes in the graph points of a PCA generated by ggplot2 for example (masculinos = square, feminine = triangle ...).     
asked by 17.02.2017 / 03:34
1
answer

Reverse factors in only 1 bar in ggplot2

Does anyone have any idea how to order the factors in just 1 bar in ggplot2? Reorder data no longer works: ( In case I would like to invert the first bar, so that the green one stays up and the red one down. library(ggplot2) dados <...
asked by 12.06.2017 / 20:23
1
answer

Plotting Graphics ggplot within loop

I'm trying to create a for using ggplot: Carteira<-cbind(A, B, C,D,E,F) A, B, C, D, E, F are data in the "zoo" format. My code is: for(i in 1:6){ ggplot(Carteira[,i], aes(Carteira[,i])) + geom_histogram(aes(y =..density..),...
asked by 13.09.2015 / 00:13
2
answers

How to invert the order of the labels in a bar graph stacked with ggplot2?

I'm trying to create a chart with the following code: ggplot(data=percent.prod, aes(x=Ano, weights=Percent)) + geom_bar(aes(fill=Tec), color="Black") + geom_text(aes(x=Ano, y=Percent, group=Tec, label=Percent),...
asked by 19.11.2017 / 15:28
1
answer

Stacked bar chart - Labels and Sorting - GGPLOT

I am constructing a graph indicating the population of the Brazilian states, organized by regions, according to the code below: State <- c("Rondônia", "Acre", "Amazonas", "Roraima", "Pará", "Amapá", "Tocantins", "Maranhão", "Piau...
asked by 12.10.2017 / 04:54
1
answer

How to change the scale of maps in ggplot2?

I'm making a map with ggplot and ggmap. However, the axis scales are in decimal degrees, but I need them in degrees, minutes, and seconds. Thanks for the help!     
asked by 15.08.2017 / 00:51