Displaying 20 results from an estimated 4000 matches similar to: "plotting dates, incorrectly scaled x-axis?"
2012 Oct 26
2
connect points in charts
Hi
is there a automatic way that long distances between points are not
connected. I have something like
plot(x,y,type="o",...)
atx <- seq(as.Date("2009-04-01"),as.Date("2011-04-01"),"month")
axis.Date(1, at=atx,labels=format(atx, "%b\n%Y"), padj=0.5 )
but I do not want lines between points whose distance is greater than
two weeks.
thx
2012 Sep 17
3
eval(parse(...)) only once in a function
Hi
I would like to have something like
str <- "df$JT == 12"
fun <- function(df) {
b <- eval(parse(str))
return(b)
}
but for performance "eval(parse(a))" should not be evaluated at each
function call, but should work as
fun <- function(df) {
b <- df$JT == 12
return(b)
}
Do you have an idea how I can implement this?
Thx
Christof
2012 Jul 02
2
save conditions in a list
Hi
how would you save conditions like
a = "day > 100"; b = "val < 50"; c = "year == 2012"
in a list? I like to have variables like "day", "val", "year" and a list
of conditions list(a,b,c). Then I want to check if a & b & c is true or
if a | b | c is true or similar things.
Greetings
Christof
2005 Aug 18
1
axis label justified
Hi, I am trying to make my axis labels left justified,
and have used adj=0 in the axis() without success. Can
anyone have a suggestion?
axis(2,at=1:50,labels=paste('a',1:50,sep=''),las=2,cex.axis=0.5,adj=0,tck=0,mgp=c(3,0.5,0))
Thanks
2010 Mar 24
1
isdst warning when rounding a range of time data: fix or suppress?
Hi, I'm working with timeseries data. The values are every 5 seconds and each series can last up to 4-5 days.
To generate the x-axis labels, I'm doing the following:
=========================
# Variable for displaying hours on the x-axis
rtime <<- as.POSIXct(round(range(timedata), "hours"))
# Variable for displaying days on the x-axis
stime <<-
2012 Aug 14
3
self-starter functions for y = a + b * c^x
Hi
there are some predefined self-start functions, like SSmicmen, SSbiexp,
SSasymp, SSasympOff, SSasympOrig, SSgompertz, SSflp, SSlogis, SSweibull,
Quadratic, Qubic, SSexp (nlrwr)
Btw, do you know graphic examples for this functions?
The SSexpDecay (exponential decay) for y = (y0 - plateau)*exp(-k*x) +
plateau from
2005 May 25
1
Plot: Distance between tick and tick label on y-axis
Hello,
I want to reduce the distance between my ticks and their labels. I managed
to do it for the x-axis, but the y-axis puzzles me. Here's an example where
there is no space between the x-asix ticks and labels.
par(las=1)
plot(runif(50), type="l",xaxt="n",yaxt="n",ylab="", bty="l")
axis(2)
axis(1,padj=-1.5)
#However,
axis(2,padj=-1.5)
2012 Oct 02
3
lattice xyplot, get current level
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current
2009 Jul 29
1
Drawing lines in margins
Hi all,
Quick question: What function can I use to draw a line in the margin of a plot? segments() and lines() both stop at the margin.
In case the answer depends on exactly what I'm trying to do, see below. I'm using R v. 2.8.1 on Windows XP.
Cheers,
Alan
I'm trying to make a horizontal barplot with a column of numbers on the right side. I'd like to put a line between the
2012 Jan 20
3
break an axis.POSIXct
Hi
I like to use "axis.POSIXct" to plot days from 2006 till 2008. But I
only have datas for the summer months. Is it possible to get two axis
breaks, to have not so long distances without points?
thx
Christof
2012 Apr 06
1
Saving multiple plots using tiff function
Dear R experts,
I am trying to save three plots using tiff graphics devices; however the
following code only produces two files (Rplot002.tif and Rplot003.tif)
showing figures 1 and 3. Here is a simplified ex code
tiff(filename ="Rplot%03d.tif",width=24,height=20,units="cm",res=300,
pointsize=10, compression = "lzw")
plot(1)
mtext("Fig
2005 Jan 31
2
how to move x-axis labels down
Hi,
In the code below, the labels I put on the x-axis are too high (they cross the
axis). Can anyone tell me how to move them down? I've tried adj=, padj=, mar=,
and various other things, but cannot move them down.
Thanks.
-Ben
labs <- paste('sample', 1:10)
plot(1:10, xaxt='n', xlab='')
axis(1, at=1:10, labels=labs, padj=1, las=2) # las is a par() parameter
2011 Nov 26
2
simplify source code
Hi
I would like to shorten
mod1 <- nls(ColName2 ~ ColName1, data = table, ...)
mod2 <- nls(ColName3 ~ ColName1, data = table, ...)
mod3 <- nls(ColName4 ~ ColName1, data = table, ...)
...
is there something like
cols = c(ColName2,ColName3,ColName4,...)
for i in ...
mod[i-1] <- nls(ColName[i] ~ ColName1, data = table, ...)
I am looking forward to help
Christof
2012 Jan 09
2
RODBC vs gdata
Hi
one col in my Excel file contains many numbers. But on line 3000 and
some other lines are strings like "FG 1". "RODBS" seems to omit this
lines. "gdata" works, but is much slower.
Is this a bug of RODBC or do I apply it wrong?
Example with the same "file.xlsx"
library(RODBC); excel <- odbcConnectExcel2007("file.xlsx")
tab <-
2009 May 16
2
Question about barplot: gridlines & value labels
Hello!
I promise I looked into help files before asking. Still cannot figure
it out. I think it's because I am totally confused what packages use
lettice, which use trellis, etc.
Sections 1 and 2 below produce the data and the data to plot. My
question is about barplot in Section 3. I am trying to:
1. add only horizontal gridlines and manipulate the type and color of
that line. tck = 1 is not
2010 Apr 20
1
multiple plots problem
hello,
i try to plot 3 graphs which have the same x.axis underneath each other. i'd
like the plots to be aligned without margings between the boxes and draw a
single x axis beneath the lowest plot.
i managed to get the alignment by setting par(mar), but the middle box is
stretched
and i cant't figure out how to get around this. par(pin) was my guess, but
this doesn't do the job
2007 Sep 02
2
Different behavior of mtext
Dear R Users,
I am quite surprised to see that mtext gives different results when it
is used with 'pairs' and with "plot'. In the two following codes, it
seems that the 'at' argument in mtext doesn't consider the same unit system.
I would appreciate your comments on this issue.
Sebastien
##### Pairs
mydata<-data.frame(x=1:10,y=1:10)
par(cex.main=1,
2011 Dec 09
1
apply on function with vector as result
Hi,
a have some code like
myfunc <- function(x) { ...; return c(a,b) }
ys <- sapply(0:100,myfunc)
so I get something like c(c(a1,b1),c(a2,b2),...)
But now I need the "as" and "bs" in one vector
as <- apply(ys, function(c(a,b)) a)
bs <- apply(ys, function(c(a,b)) b)
Can you help me with the correct syntax, instead of my pseudo code?
thx
Christof
2012 Jul 21
1
alternative to rbind for data.table
Hi
I want to add a row to a "data.table" in each round of a for loop.
"rbind" seems to be a inefficient way to implement this.
How would you do this? The "slow" solution:
library(data.table)
Rprof("test.out")
dt <- data.table()
for (i in (1:10000)) {
# algorithm that generates a list with different values,
# but same key-names, each round, for
2010 Nov 20
2
plotting a timeline
I was trying to recreate this kind of timeline plot:
http://www.vertex42.com/ExcelArticles/create-a-timeline.html
As you can see in their excel example, the events are nicely placed out on
both sides of the timeline axis.
AFAIK there is no function to do this nicely in R-project. Furthermore,
graphics and lattice packages are unable to draw the x-axis in the middle of
the plot. (datapoints