Displaying 20 results from an estimated 6000 matches similar to: "ggplot2 dot chart-start at zero"
2009 Aug 10
2
ggplot: colours to geom_segments
Just as an exercise I am tying to add colours to a geom_segment command. I can get one colour but not a sequence of colours.
Can anyone suggest how I can get the green lines in the plot below to be different colours? I thought I could use a palatte of colours but that did not seem to work.
Thanks
=========================================================================
library(ggplot2)
xx
2013 Jan 24
1
Insert segment only on particular facets in ggplot
Dear R users,
I am working on a data-set with 3 species. They are apple, orange and
banana.
I want to annotate the facets only on the bottom panel. However, by default
I am getting annotations on all the plots. I was able to get text
annotation only on the desired plot. However, I am confused what I need to
do for the arrows / segments.
Here is my code:
library(ggplot2)
library(grid)
tempobs
2011 Dec 09
3
ggplot with geom_tile
Dear R-users,
I am trying to make a plot with ggplot-geom_tile(), but cannot remove some unwanted (white) lines through my plot.
Below a reproducible example:
#####
library(ggplot2)
tot=as.data.frame(rep(seq(-50,50,5),each=21))
names(tot)="precip"
temp=rep(seq(-5,5,0.5),21)
tot$temp=temp
disc=array(dim=c(21,21))
for(i in 1:21){
for(y in 1:21){
temp<-
2010 Apr 23
1
ggplot2: how to specify x-axis limits to geom_abline() ?
Hi all,
I'd want to plot a segment from a line specified by slope and intercept.
I want to plot this line between two limits, x1 and x2, without imposing
these limits to the hole plot as it is the case with
scale_x_continuous(limits=c(x1,x2)) or with xlim and ylim.
Any idea?
Arnaud Chozo
[[alternative HTML version deleted]]
2012 Jul 13
2
alternate tick labels and tick marks with lattice xyplot
Hi,
I would like to use xyplot to create a figure. Unfortunately, I cannot find
documentation in xyplot to specify alternating the x-axis tick labels with
the x-axis tick marks. I can do this with the regular R plot function as
follows.
#A small version of my data looks like this
data<-data.frame(matrix(ncol=3,nrow=12))
data[,1]<-rep(c(1,2,3),c(4,4,4))
data[,2]<-rep(c(1,2,3,4),3)
2020 Oct 20
1
Dibujar un gráfico con 4 terms - ggeffects + plot
Hola eRRer en s,
He creado un modelo mixto (adjunto) con lme4
He dibujado la predicción usando:
df <- ggpredict(m.glob.pre.anu
, terms = c("pre", "area_m2", "sum.vs.win")
)
plot(df)
Luego he arreglado el gráfico usando:
df <- ggpredict(m.glob.pre.anu
, terms = c("pre", "area_m2",
2013 May 18
3
bar plot with non-zero starting level
Hi,
I want to plot grouped bars to compare 95% confidence interval estimates
from two models. Each bar represents a 95% confidence interval estimate
of a coefficient from one of the two models. Each group represents
confidence interval estimates of the same coefficient from the two models.
I think such a bar plot will nicely present whether 95% confidence
interval estimates of the same
2008 Jun 04
1
ggplot questions
Hello,
A few questions about the following examples:
1. Why do the two plotting versions not produce the same result?
2. Is the 'scale_x_continuous' (or *_y_* or *_*_discrete) geom the best
way to setup grids (as in visual guide-lines) in polar (or for that
matter, any) coordinate system?
3. Why do these commands appear to generate 3 plot pages each?
4. Perhaps more questions to follow
2008 May 12
1
Converting qqplot2 qplot() to grammar?
Hello all,
I've been using the following qplot command:
qplot(pixX,pixY, data=som, geom="tile", fill=rgb) +
scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY)
Now I would like to convert it into the explicit ggplot grammar, so I
can remove the extras: axes, labels, background, borders, facet labels,
and extra white-space around the plot. (If anyone has
2011 Nov 15
2
break error bars in ggplot2
Hello,
i use ggplot to plot some measures including CIs as horizontal errorbars. I get an error when the scale limits are narrower than the boundaries of the error bar and hence the CIs are not plotted.
library(ggplot2)
df <- data.frame(resp=c(1,2), k=c(1,2), se=c(1,2))
ggplot(df, aes(resp,y=k)) + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp - se)) +
2010 May 11
2
predicting without a model
Hello:
I have 5 years of weekly passage data and want to predict fish passage
for the following year. I don't have a model to use to predict data for
the sixth year. Can I somehow still predict based on these five years?
I just want to see on the graph what the predicted year would look like
and how those?new values are generated. Gracias?
?
?fall <- structure(list(week = c(48L, 49L, 50L,
2012 Nov 07
1
change colour of geom_step by scale_colour_manual
Hi,
Color of my step plot is now by default. Now I'd like to change the color as
the grey scale I specified. I don't know why I got three black plot. Here I
attach two version of codes. The first one produces a step plot with color
by default. The second one, modified from the first one, is not producing
the grey scale I want. Any help would be highly appreciated.
[version 1- working]
2013 Mar 25
2
Plot Matrix with Data
Hi ,
I would like to use ggplot2 to plot a matrix as an image.
You can copy paste the following
Data<-matrix(data=rnorm(900,80,20),nrow=30,ncol=30)
lengthOut<-5
Lengths<- 15
library(reshape2)
library(ggplot2)
tdm <- melt(Data)
ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value)),levels=seq(0,1,by=0.1)) +
labs(x = "MHz", y =
2011 Jul 10
2
grey colored lines and overwriting labels i qqplot2
I created this graph in ggplot and added ablines to the different facets by
specifying with subset commands. As you might see, there are still a few
issues.
1.) I would like to have the diamonds in a grey scale instead of colors. I
accomplished this (see graph 2) until I overwrote the label title for the
treatments and the colors came back (graph 1). I used these two commands:
p=ggplot(data =
2012 Dec 12
1
Problems with plot maps
Hello,
I need plot map using ggplot()
I use such code:
library("ggplot2")
library(cshapes)
cshp.data <- cshp()
map <- cshp.data[cshp.data$COWCODE==369,]
map_mp<- list(
geom_polygon(aes(long, lat, group = group), data = map, fill = "grey70",
colour = "grey60", inherit.aes = FALSE, show_guide = FALSE),
scale_x_continuous("",
2008 Dec 24
2
ggplot2 Xlim
Hi: I need some help.
I am ploting a bar graph but I can't adjust my x axis scale
I use this code:
i <- qplot(ForkLength,Number,data=FL,geom="bar")
i + geom_bar(colour="blue",fill="grey65") # too crowded
FL_dat <- ggplot(FL,aes(x=ForkLength,y=Number)) + geom_bar(colour="green",fill="grey65")
FL_dat +
2009 Jan 29
2
Adding vertical line to histogram and qplot "stacked" plot
R-users it appears I am leaning on your knowledge once again. Is there any way to add a vertical line to a histogram and qplot "stacked" plot? Here is my current attempt:
"qplot" approach attempt:
qplot(Run, data = data_dataframe, breaks = breaks, fill = Temperature, main = short_title) + scale_x_continuous("Data") + scale_y_continuous("Freq")
2008 Mar 25
2
ggplot2 - facetting
Dear All,
After having overcome the issue of legends (thanks, Thierry, once
more), I am trying to use facetting, but here also I can not find how
to do this. I do not want to use qplot, but rather the more flexible
options. However, it seems I am doing still something pretty stupid,
because I always get an error, even if it seems I am doing everything
like the examples.
My code is below.
2011 Aug 31
2
ggplot2 to create a "square" plot
Dear all,
I am using ggplot with geom_tile to print as an image a matrix I have. My matrix is a squared one of 512*512 cells.
The code that does that is written below
> print(v + geom_tile(aes(fill=dB))+ opts(axis.text.x=theme_text(size=20),axis.text.y=theme_text(size=20), axis.title.x=theme_text(size=25) , axis.title.y=theme_text(size=25), legend.title=theme_text(size=25,hjust=-0.4) ,
2009 May 19
2
Coord_equal in ggplot2
Dear all,
I'm plotting some points on a graph where both axes need to have the
same scale. See the example below. Coord_equal does that trick but in
this case it wastes a lot of space on the y-axis. Setting the limits of
the y-axis myself was no avail.
Any suggestions to solve this problem?
library(ggplot2)
ds <- data.frame(x = runif(1000, min = 0, max = 300000), y = runif(1000,
min =