search for: myplot

Displaying 20 results from an estimated 131 matches for "myplot".

Did you mean: xyplot
2005 Oct 03
2
grob questions
If I run the following example from: http://www.stat.auckland.ac.nz/~paul/grid/doc/grobs.pdf > grid.newpage() > pushViewport(viewport(w = 0.5, h = 0.5)) > myplot <- gTree(name = "myplot", children = gList(rectGrob(name = "box", + gp = gpar(col = "grey")), xaxisGrob(name = "xaxis"))) > grid.draw(myplot) > grid.edit("myplot::xaxis", at = 1:10/11) > grid.edit("myplot::xaxis::labels", label...
2005 Mar 09
3
function in order to plot the same graph to postscript and pdf
Hi, I've written a function in order to plot the same graph in a postcript and in a pdf file. Unfortunately, the second graph is always empty, i.e.: plot.both <- function{myplot, filename}{ pdf(file=paste(filename, ".pdf", sep="")) myplot dev.off() postscript(file=paste(filename, ".eps", sep="")) myplot dev.off() } yields in a correct pdf but an empty eps file. However something like this: plot.both <- function{myp...
2009 Apr 04
2
help with formula and data= argument
...thod to work with this in a simple case but am having trouble determining how to "find" a variable from within the data= argument that is not part of the formula. The following code illustrates (I know that plotrix::thigmophobe.labels() does what this function does) my problem ... myplot <- function(x,y=NULL,data=NULL,label=NULL) { if (class(x)=="formula") { mf <- model.frame(x,data=data) x <- mf[,2] y <- mf[,1] } if (is.null(y)) stop("Y-axis variable is missing") plot(x,y) if (!is.null(label)) text(x,y,label) } # d...
2011 Feb 15
0
Relationships between png resolution, axis.text$cex trellis setting, and paddings
...ad2=0), right=list(tck=0, pad1=0, pad2=0))) inter.theme <- modifyList(cur.settings, theme) return(inter.theme) } df <- data.frame(x=-10:10,y=rnorm(21)) myplot <- xyplot(y~x,data=df, xlab="Whatever",ylab="Random") png(file='padding_test_normal_125.png', width=750, height=750, res=125) trellis.par.set(my.theme()) print(myplot, split=c(1,1,2,2), more=TRUE,newpage=TRUE) print(myplot, split=c(1,2,...
2008 Aug 08
2
gridBase and new.page() / grid.newpage()
...ow. In the case of the pdf plot pages are preceded by a blank page. However, leaving out either plot.new() or grid.newpage() each presents different problems. I looked through the R Graphics book and package vignette but didn't see this particular issue addressed. Thanks in advance, Peter myplot <- function() { grid.newpage() plot.new() n <- 10 datalayout <- grid.layout(ncol = 2, width = unit(c(1, 1/n), c('null', 'null'))) pushViewport(viewport(width = .8, height = .8, layout = datalayout)) grid.rect(gp=gpar(col="grey")) for(...
2009 Sep 02
1
get function to return object "name"?
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't know how to refer to this generically (the object "name&...
2009 May 04
1
ellipsis problem
...et passed through to the inner plot, while others cause an error: Error in eval(expr, envir, enclos) : ..1 used in an incorrect context, no ... to look in As a minimal example: tmp <- data.frame(Y = sample(1:10, 40, replace = TRUE), X = sample(1:10, 40, replace = TRUE)) myplot <- function(x, ...) { plot(Y ~ X, data = x, ...) } myplot(tmp) ## works fine myplot(tmp, tcl = 1) ## works fine myplot(tmp, tcl = -0.1) Error in eval(expr, envir, enclos) : ..1 used in an incorrect context, no ... to look in myplot(tmp, mgp = c(3, 0.5, 0)) Error in eval(expr, envir, encl...
2009 Sep 14
2
How to set default plotting colors by treatment?
...lored by treatment to quickly check things: with(mydfr, plot(Xmeas, Ymeas, pch=19, col=c("blue","red")[treatment])) # I find it annoying to keep typing in all the bits after Ymeas (yes I use a text editor but that's not the point...) # I tried defining a function like this myplot <- function(...)plot(..., pch=19, col=c("blue","red")[treatment]) # So i can call it like this: with(mydfr, myplot(Xmeas, Ymeas)) # but: Error in plot.xy(xy, type, ...) : object 'treatment' not found I don't understand why the 'with' statement does not...
2010 Dec 17
2
Nested layout()
Hello, Is it possible to call a graphing function that uses layout() multiple times and layout those outputs ? Here's a minimal example : myplot <- function() { layout(matrix(1:2, nrow=1), widths = c(1, 1)) plot(1:10) plot(10:1) } layout(matrix(1:2), heights = c(1, 2)) myplot() myplot() -------------------------------------- Dario Strbenac Research Assistant Cancer Epigenetics Garvan Institute of Medical Research Darlinghurst NSW 20...
2010 Apr 07
1
ggplot2, density barplot and geom_point layer
...iamonds[myDiamonds[["clarity"]]=="IF","clarity"] <- 8 myDiamonds[["clarity"]] <- as.numeric(myDiamonds[["clarity"]]) # Calculate medians medians <- ddply( myDiamonds, .(cut), summarize, med=median(clarity, na.rm=TRUE) ) # Works myPlot <- qplot( factor(clarity), data=myDiamonds, fill=cut, geom="bar", position="dodge" ) myPlot + geom_point( data=medians, aes(x=med,shape=cut), y=0, size=2.5, ) # Doesn't work - I want density rather than count myPlot <-qplot( factor(clarity), y...
2008 Sep 25
2
ggplot, qplot in loop
...:length(trials)) { sql <- paste("select trial, cover_of, dateofsurvey, cover from mytable where trial = '",trials[i],"' mydata <- (sqlQuery(channel, sql)) mytitle <- paste("Development of Cover, ", trials[i],",sep = "") myplot <- qplot(dateofsurvey, cover, data=mydata, geom="area", fill=cover_of, main = mytitle, ylab="projective Cover[%]", xlab = "Year") myplot <- myplot + scale_fill_manual(values = mycolours) } If I have no loop, everything works, with the loop, no graphic...
2007 Jun 14
2
function with xyplot
Hi, I'm a new user trying to switch from SAS, so sorry for the beginner's question: Suppose I have a dataframe DF that contains variables X,Y,Z. I am trying to write a function like this: myplot <- function(varname){xyplot(varname ~ Y, group = Z, data = DF)}. The problem is then how to enter X into my function. If I write myplot("X") I get an error because the argument is a string and xyplot can make nothing out of it. If I write myplot(X) I also get an error that tells me th...
2000 Aug 17
1
Things I don't understand about the graphics interface
Using R-1.1.1 on RedHatLinux 6.2. I've made some progress, succeeded in outputting bitmap, jpeg, and png files. Yipee. I did them with this command: > dev2bitmap("whatever.bmp",res=300) > dev.print(png, file="myplot.png", width=480, height=480) > dev.print(jpeg, file="myplot.jpg", width=480, height=480) > dev.print(pictex, file="myplot.tex", width=480, height=480) Now here are the things I don't understand about the docs and/or this interface. I understand these functions...
2001 Jan 10
1
eval() bug in plot.formula() ?
I don't have time now to investigate myself, and I'm not feeling like deciding myself if the following is a bug: myplot <- function(dat, cex = 1.2, ...) { if(!is.data.frame(dat <- as.data.frame(dat))) stop("`dat' must be a data.frame") if(any(is.na(match(c("x","y"), names(dat))))) stop("`dat' must have a `x' and a `y' component") p...
2011 Jun 29
2
Testing if a variable is specified within a function & adding TRUE/FALSE options to functions
I have 2 related questions about functions. 1. I am writing a function to plot data from a time series with the form myplot<-function(data, d1,d2) { } Where d1 and d2 are two dates in a time series. The idea being that if no values for d1 and d2 are entered then the function defaults to plotting the whole time series, else it plots the data for the interval specified by d1 and d2. I am attempting to test if the...
2010 Jan 14
2
Newbie mistakes saving images to files
...ng problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### <script> png("Image %03d.png") # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot("a") myPlot("b") myPlot("c") myBarchart("a") myBarchart("b") myBarchart("c") myBarchart2("a") myBarchart2("b") myBarchart2("c") dev.off() ### </script> When I run the code a few lines at a time it g...
2005 Aug 14
1
complex expression with plotmath
Hello everyone, I want to define a function that receives the name of two variables (may include Greek letters and subscripts) and uses them into the title of a plot. My best attempt is the following: myplot <- function(var1, var2) { v=paste(var1,"==1 & ",var2,"==2"); plot(1:10, main=parse(,,v)) } But when I call it with something like myplot("Q[i]", "Delta[j]") I get "&(Q_i=1,Delta_j=2)" as title when I want to get "Q_i=1 &...
2007 Jan 04
0
dashed lines and SVG files devSVG("/folderul/unde/salvez/myplot.svg", width=10, height=10) plot(1:10, 1:10) dev.off()
Dear helpers, I have a question about the SVG device. It works fine, the SVG file is indeed produced, only the graphic differs from the R window. In the SVG file the dashed line is just a regular plain one. My toy example is: library(RSvgDevice) devSVG("myplot.svg", width=10, height=10) plot(1:10) abline(v=5, lty=?dashed?) dev.off() Is there anything more (or different) I should do? Many thanks in advance, Adrian
2017 Nov 02
3
ggplot inside function doesn't plot
I have a function: myplot <- 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)) +...
2007 Dec 09
1
R + LaTeX formula
Hi, what is actually the best method to include R-plots into LaTeX documents? At the moment i use postscript("myplot.eps", width = 12.0, height = 9.0, horizontal = FALSE, onefile = TRUE, paper = "special",encoding = "TeXtext.enc") plot(foo,bar) dev.off() But it is a bit unhandy to scale later and its difficult to get nice formula in the plots. And how should i write formulas on the...