Displaying 20 results from an estimated 3000 matches similar to: "Question about barplot: gridlines & value labels"
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
2009 May 18
1
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
Hello!
I have a question about my lattice barchart that I am trying to build
in Section 3 below. I can't figure out a couple of things:
1. When I look at the dataframe "test" that I am trying to plot, it
looks right to me (the group "Total" is always the first out of 5).
However, in the chart it is the last. Why?
2. How can I make sure the value labels (on y) are not
2009 May 16
1
barplot in a loop not printing out to directory
Hello!
I am experiencing a problem with section 3 of the code below. I want
to generate barplots (based on data generated in Sections 1 and 2) in
a loop - for each variable in "data" - and save them as .emf files in
my current directory. But it's not working - it's printing values to
be plotted to the screen but does not print the plots themselves
anywhere (and not in the
2009 Feb 18
1
interaction.plot - gridlines and formatting legend title...
Thank you for providing advice on this graphics question.
I am building an interaction.plot.
d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.2,4.4,3.5,3.3,-1.1,-1.3)
d[[1]]<-as.factor(d[[1]])
d[[2]]<-as.factor(d[[2]])
print(d)
interaction.plot(d$xx, d$yy, d$zz,
type="b", col=c("red","blue"), legend=F,
lty=c(1,2), lwd=2, pch=c(18,24),
2008 May 07
2
figure margins too large for a barplot in png, pdf ok
I've used to have a script with a barplot command it in, preceded by a
png:
png(graph.file,height=H,width=W)
barplot(t,names.arg=breaks[2:(length(t)+1)],tck=gridlines)
-- worked before R 2.6.2. When I tried it in R 2.6.2, which I have
for a while but didn't run with that script, it complained, the
margins too large, and I've googled the messages from our list where
neither
2009 Nov 20
1
Hmisc and Lattice question on gridlines
I have been using lattice xyplot and am quite pleased, and I can use the
type=c("b","g") to have it print gridlines into the page, yet if I want to
have a line plot with points on it, how do I get the xYplot to print
gridlines (I use Hmisc xYplot because of its bands method which allows
plotting of confidence intervals). Any suggestions? I have looked at the
panel functions but
2007 Feb 21
3
Different gridlines per panel in xyplot
In the example R script below, horizontal gray gridlines are drawn at y
coordinates where the points are drawn with the code:
panel.abline(h=y, v=xScale, col.line="gray")
How do I change this so that the horizontal gray gridlines are drawn at y
coordinates where the y labels are drawn? The challenge is that each panel
has different y-ranges (in my real example the y-ranges and
2010 Apr 22
2
How to insert gridlines in lattice density plot
Greetings.
How can I insert gridlines
in the following density plot call?
Must one compose a panel function?
'data.frame': 46 obs. of 2 variables:
$ fallrates: num 5.2 7.1 7.1 9.8 3.7 7.5 5 6.2 1.5 2.9 ...
$ prepost : Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
library(lattice)
densityplot(~fallrates, groups = prepost,
2010 Oct 04
1
adding a legend to the plot (but outside of it)
Hello!
My code below creates a data frame and a plot for it.
However, I can't figure out how to add a legend that is not ON the
plot itself, but outside of it (e.g., to the right of my graph or
below it). I tried something: I put a line par(xpd=T,
mar=par()$mar+c(0,0,0,4)) right before my plot command), but that
screwed up all my gridlines - they covered all graph and do not
coincide with
2008 Sep 08
7
Question about multiple regression
Dear R-list,
maybe some of you could point me in the right direction:
Are you aware of any FREE Fortran or Java libraries/actual pieces of
code that are VERY efficient (time-wise) in running the regular linear
least-squares multiple regression?
More specifically, I have to run small regression models (between 1
and 15 predictors) on samples of up to N=700 but thousands and
thousands of them.
I
2009 Apr 23
4
rbind data frames stored in a list
Hello everyone!
I have a list X with 3 elements, each of which is a data frame, for example:
a<-data.frame(a=1,b=2,c=3)
b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9))
c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18))
X<-list()
X[[1]]<-a
X[[2]]<-b
X[[3]]<-c
(X)
How can I most effectively transform X into a data frame with columns
a, b, and c?
I would love to find a generic
2009 Apr 28
4
Producing customized tickmarks when producing a graph using "curve"
Hello!
I am using function "curve" to create a line graph.
I was wondering, if it's possible to "turn off" the default tick marks
and introduce those tick marks in specific locations.
For example, currently in my X axis tick marks are (automatically) at
10, 11, 12, 13 but I want them to be in 5 specific locations, like
9.89, 10.34, etc.
Any hint would be greatly
2008 Jan 25
3
plotting gridlines
dear all,
I have a very simple question but I could not figure out.
I need to make plots with grid in the background.
something like I old retrive like this
a=runif(100)*10
b=runif(100)*10
plot(a,b, pch=20, xlim=c(0, round(max(a))), ylim=c(0, round(max(b))))
vs=seq(0, max(a), 0.5)
for(i in 1:length(vs)){
abline(v=vs[i], col="lightgrey")
}
hs=seq(0, max(b), 0.5)
for(i in
2004 Mar 11
1
tics and grids
Hi,
Whats the easiest way to set a desired interval for tics on axes in R ?
And will the 'grid' command put gridlines on all tics automatically ?
I tend to get stuck with graphs with ranges 0-1 with only 2 tics and 2
gridlines in the 0-1 range, while I would like 10 tics (or every 0.1)
tnx,
Piet
please reply to pvremortNOSPAM at vub.ac.be
2009 Aug 25
1
Lattice graph tweaking
To: silwood-r
Subject: Removing lattice graph gridlines and editing label box colour
Hi,
Is it possible to remove the background gridlines from a lattice graph (ie graph made up of multiple individual graphs with annoying blue grid in the backgroun)?
Also, Is it possible to change the colour of the individual graph label boxes? - ie the default pink boxes above the individual graphs
Thanks
2009 Mar 26
2
Analogy for %in% for the whole columns (rather than individual values)
Hello!
I have a matrix a with 2 variables (see below) that contain character strings.
I need to create a 3rd variable that contains True if the value in
column x is equal to the value in column y. The code below does it.
a<-data.frame(x=c("john", "mary", "mary",
"john"),y=c("mary","mary","john","john"))
2009 Feb 11
2
changing settings on a barchart (lattice)
Hello!
I apologize - I never used lattice before, so my question is probably
very basic - but I just can't find the answer in the archive nor in
the documentation:
I have a named numeric vector p of 6 numbers (of the type 6 numbers
with people's names to whom those numbers belong). I want a simple bar
chart.
I am doing:
library(lattice)
trellis.par.set(fontsize=list(text=12)) #
2009 Feb 16
2
Printing out a graph using different graphics devices
Hello, everyone!
The code below allows me to produce the graph I want (I know - the
colors are strange, but it's just for the sake of an example).
After you run the plot<- part and then do print(plot) - that's what I want.
However, when I run the bits of code below (with graphics devices) -
what they print is different from the original plot. In .png, .emf,
and .tiff - my dots change
2009 Apr 23
2
transposing a matrix - row by row?
Hello,
I have a matrix that is a product of tapply on a larger data set.
Let's assume it looks like this:
X<-matrix(c(10,20,30,40,50,60),2,3)
dimnames(X)<-list(c("1","2"),c("1","2","3"))
(X)
1 2 3
1 10 30 50
2 20 40 60
Is there an efficient way of transforming this matrix into the following matrix:
rows columns entries
1
2009 Apr 10
1
Random Forests: Question about R^2
Dear Random Forests gurus,
I have a question about R^2 provided by randomForest (for regression).
I don't succeed in finding this information.
In the help file for randomForest under "Value" it says:
rsq: (regression only) - "pseudo R-squared'': 1 - mse / Var(y).
Could someone please explain in somewhat more detail how exactly R^2
is calculated?
Is "mse"
2009 Feb 10
1
Putting values and axis X labels on the charts based on allEffects
Dear everybody!
Need help with graphics. I am runnig a simple lm and then using
allEffects from 'effects' package:
require(effects)
model<-lm(Y~A+B, data=mydataframe)
I am trying to build (for each predictor - A and then B) a plot of means on Y.
I was successful doing it like this - in one swoop:
ml.eff<-allEffects(ml1, se=F)
plot(ml.eff,ylab="Title of Y")
Is it