Displaying 20 results from an estimated 26 matches for "scale_y_log10".
2011 Mar 29
1
ggplot2: scale_y_log10() with geom_histogram
Dear ggplot2 users,
is there an easy/elegant way to suppress zero count bars in histograms with
logarithmic y axis ?
One (made up) example would be
qplot(exp(rnorm(1000))) + geom_histogram(colour = "cornsilk", fill =
"darkblue") + scale_x_sqrt() + scale_y_log10()
Thanks!
Markus
[[alternative HTML version deleted]]
2007 May 12
2
Implicit vs explicit printing and the call stack
...system.time requires a explicit print, but it's on the order of a few
seconds).
I'm not sure if I've provided enough information to be able to solve
the problem, so please let me know what additional details would be
useful.
Thanks,
Hadley
> ggplot(mtcars, aes(x=cyl, y=-mpg)) + scale_y_log10() + geom_point()
Error in grid.pretty(.$domain()) : infinite axis extents [GEPretty(-inf,inf,5)]
In addition: Warning messages:
1: NaNs produced in: log(x, base)
2: no non-missing arguments to min; returning Inf
3: no non-missing arguments to max; returning -Inf
4: no non-missing arguments to min;...
2017 Nov 02
3
ggplot inside function doesn't plot
...function (X) {
d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE)
png(paste("img/", X, ".png", sep=""))
ggplot(d, aes(x=condition, y=count, color=condition)) +
geom_point(position=position_jitter(w=0.1,h=0)) +
scale_y_log10(breaks=c(25,100,400)) +
ggtitle(X) +
theme(plot.title = element_text(hjust = 0.5))
dev.off()
}
'd' is a dataframe
count condition
E11.5 F20HET BA40_quant 955.9788 E11.5 F20HET
E11.5 F20HET BA45_quant 796.2863 E11.5 F20HET...
2017 Nov 02
3
ggplot inside function doesn't plot
...Counts(dds2, gene=X, intgroup="condition", returnData=TRUE)
>> png(paste("img/", X, ".png", sep=""))
>> ggplot(d, aes(x=condition, y=count, color=condition)) +
>> geom_point(position=position_jitter(w=0.1,h=0)) +
>> scale_y_log10(breaks=c(25,100,400)) +
>> ggtitle(X) +
>> theme(plot.title = element_text(hjust = 0.5))
>>
>> dev.off()
>> }
>>
>> 'd' is a dataframe
>>
>> count condition
>> E11.5 F20HET BA40_...
2017 Nov 02
0
ggplot inside function doesn't plot
...d <- plotCounts(dds2, gene=X, intgroup="condition", returnData=TRUE)
> png(paste("img/", X, ".png", sep=""))
> ggplot(d, aes(x=condition, y=count, color=condition)) +
> geom_point(position=position_jitter(w=0.1,h=0)) +
> scale_y_log10(breaks=c(25,100,400)) +
> ggtitle(X) +
> theme(plot.title = element_text(hjust = 0.5))
>
> dev.off()
> }
>
> 'd' is a dataframe
>
> count condition
> E11.5 F20HET BA40_quant 955.9788 E11.5 F20HET
>...
2017 Nov 29
3
Removing a data subset
...")
#Removes the NAs
MyDataWONA <- MyData[!is.na(MyData$Detections), ]
#does the plot
p <- ggplot(data = MyDataWONA, aes(x=Year, y=GW_Elv , col=Detections)) +
geom_point(aes(shape=Detections)) +
##sets the colors
scale_colour_manual(values=c("black","red")) + #scale_y_log10() +
#location of the legend
theme(legend.position=c("right")) +
#sets the line color, type and size
geom_line(colour="black", linetype="dotted", size=0.5) +
ylab("Elevation Feet Mean Sea Level")
## does the graph using the Location IDs as the dif...
2008 Feb 17
1
ggplot2: bug in geom_ribbon + log scale!?
...+geom_line(data=d,aes(x=d[["x"]],y=d[["y1"]]),colour="blue")
p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y2"]]),colour="red")
p2+scale_y_continuous()
...gives the plot I want, only with my actual data, I'd need it in
log-scale:
p2+scale_y_log10()
shifts the ribbon far above the actual data (factor 1000, if I see it
right, but I haven't tested it with different data to check on that...).
I'm using the latest version of ggplot2 (0.5.7).
Has anyone any suggestions for a workaround/patch?
Many Thanks, Martin
2011 Nov 16
1
boxplot strange behavior
Hello,
I generate box plots from my data like this:
qplot(x=xxx,y=column,data=data,geom="boxplot") + xlab("xxx") + ylab(ylabel) + theme_bw() + scale_y_log10() + geom_jitter(alpha=I(1/10))
The problem is that I see lot of points above the maximum at the same level as some outliers. It looks very weird as I expected the outliers to be "few" and specially not see any points other than the outliers below the minimum or above the maximum indicato...
2007 Jul 25
1
Ggplot2 equivalent of axis and problem with log scale
...lotting the first graph.
library(ggplot2)
df <- data.frame(x = rep(1:10, 10), y = rnorm(100))
df$y <- 10 ^ (df$x + df$y)
df <- cbind(df, predict(lm(I(log10(y)) ~ x, data = df), interval = "c"))
df[, 3:5] <- 10 ^ df[, 3:5]
ggplot(data = df, aes(x = x, y = y)) + geom_point() + scale_y_log10() +
geom_line(aes(y = fit)) + geom_errorbar(aes(min = lwr, max = upr))
ggplot(data = df, aes(x = x, y = y)) + geom_point() + scale_y_log10() +
geom_line(aes(y = fit)) + geom_errorbar(aes(min = log10(lwr), max =
log10(upr)))
Thanks,
Thierry
-------------------------------------------------------...
2009 Sep 06
5
ggplot2::qplot() -- arbitary transformations of coordinate system?
Hi,
Does anyone know how to do a coord_trans() in which the y-axis is
tranformed into (for example) -1000/y?
Thanks,
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011
2017 Nov 29
0
Removing a data subset
...A <- MyData[!is.na(MyData$Detections), ]
>
> #does the plot
> p <- ggplot(data = MyDataWONA, aes(x=Year, y=GW_Elv , col=Detections)) +
> geom_point(aes(shape=Detections)) +
>
> ##sets the colors
> scale_colour_manual(values=c("black","red")) + #scale_y_log10() +
>
> #location of the legend
> theme(legend.position=c("right")) +
>
> #sets the line color, type and size
> geom_line(colour="black", linetype="dotted", size=0.5) +
> ylab("Elevation Feet Mean Sea Level")
>
> ## doe...
2017 Sep 26
2
Adding non-data line to legend ggplot2 Maximum Contaminant Level
...quot;NonDetect")
#does the plot
p <- ggplot(data = MyData, aes(x=Year, y=Chloride , col=Detections)) +
geom_point(aes(shape=Detections)) +
#sets the detect vs. non-detect colors
scale_colour_manual(values=c("black","red")) +
#sets the y scale and log base 10
scale_y_log10() +
##adds line
geom_hline(aes(yintercept=250),linetype="dashed")+
#location of the legend
theme(legend.position=c("right")) +
#sets the line color, type and size
geom_line(colour="black", linetype="dotted", size=0.5) +
ylab("Chloride (m...
2013 Apr 18
1
Arranging two different types of ggplot2 plots with axes lined up
...t fecal coliform plot
yfc_plot<-ggplot(yfc) + geom_boxplot() + aes(x=as.factor(year2), y=fc) +
opts(axis.text.x=theme_text(angle=45, hjust=1, vjust=1)) +
xlab(" \n Date") + ylab("Fecal coliforms (cfu/100 mL) \n ") +
geom_smooth(stat='smooth', aes(group=1), size=1.5) + scale_y_log10()
#arrange plots together
grid.arrange(yp_plot, yfc_plot, ncol=1)
You can see that I got the plot areas to line up using grid.arrange(), but
the x-axes are still off. I'd really appreciate any help I can get.
Thanks,
Saalem
[[alternative HTML version deleted]]
2017 Oct 05
0
Adding non-data line to legend ggplot2 Maximum Contaminant Level
...otp <- ggplot(data = MyData, aes(x=Year, y=Chloride, col=Detections)) +? geom_point(aes(shape=Detections)) +? geom_line(data = MyData,aes(y=SMCL))+?? ?#sets the detect vs. non-detect colors? scale_colour_manual(values=c("black","red")) +???? #sets the y scale and log base 10? scale_y_log10() +??? #location of the legend??? theme(legend.position=c("right")) +??? #sets the line color, type and size? geom_line(colour="black", linetype="dotted", size=0.5) +?
? ylab("Chloride (mg/L)")
## does the graph using the Location IDs as the different Locatio...
2008 Feb 15
1
ggplot2 used in a function - variable scope/environment
...ariable don't exist in
the environment calling the function.. e.g:
my function does something like:
getPlot<-function(da=NULL,...){
#1st column holds x-values, others hold data series to plot...
co<-as.character(names(da))
co<-co[2:length(co)]
pl<-ggplot(data=da)
pl<-pl+scale_y_log10()+scale_x_continuous()
for(c in co){
pl<-pl+geom_line(x=da[[1]],y=da[[c]],mapping=aes(x=da[[1]],y=da[[c]]))
}
return(pl)
}
I need to add every layer separately, because I want to be able to
explicitly define attributes for every data series (colour, size... e.g.
highlight only two speci...
2009 Jul 20
3
Histograms on a log scale
Dear All,
I would like to be able to plot histograms/densities on a semi-log or
log-log scale.
I found several suggestions online
http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html
https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html
http://www.harding.edu/fmccown/R/#histograms
Now, consider the code snippet taken from
http://www.harding.edu/fmccown/R/#histograms
# Get a random
2017 Aug 11
2
Annotation Ticks on the axis
...s my attempt :
library(ggplot2)
x<-1:10
y<-x^2
df<-data.frame(x=x,y=y)
p1<-ggplot(df,aes(x,y))+geom_point()+
scale_x_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", scales::math_format(10^.x))
) +
scale_y_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", scales::math_format(10^.x))
) +theme_bw()
p2<-p1 + annotation_logticks()
p2
p2 + scale_y_continuous(sec.axis = sec_axis(~.))
I get the following error :
Scale for ...
2008 Feb 17
2
filled.contour with log axis
Dear all,
I would like to generate a filled.contour plot with log x and y axis,
however using:
filled.contour(as.line,log="xy")
results in a warning message.
Does anybody knos what to do?
Thanks
Thomas
2007 Jun 14
1
back-transform predictors for x-axis in plot -- mgcv package
My question is related to plot( ) in the mgcv package. Before modelling
the data, a few predictors were transformed to normalize them.
Therefore, the x-axes in the plots show transformed predictor values.
How do I back-transform the predictors so that the plots are easier to
interpret?
Thanks in advance,
Suzan
--
Suzan Pool
Oregon State University
Cooperative Institute for Marine
2017 Oct 01
0
Adding non-data line to legend ggplot2 Maximum Contaminant Level
...quot;NonDetect")
#does the plot
p <- ggplot(data = MyData, aes(x=Year, y=Chloride , col=Detections)) +
? geom_point(aes(shape=Detections)) +
? #sets the detect vs. non-detect colors
? scale_colour_manual(values=c("black","red")) +
? #sets the y scale and log base 10
? scale_y_log10() +
? ##adds line
? geom_hline(aes(yintercept=250),linetype="dashed")+
? #location of the legend
? theme(legend.position=c("right")) +
? #sets the line color, type and size
? geom_line(colour="black", linetype="dotted", size=0.5) +
? ylab("Chloride (m...