[rkward-users] [rkward - Help] RE: Saving a graph

SourceForge.net noreply at sourceforge.net
Fri Nov 21 09:54:48 UTC 2008


Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=5688330
By: fsando

Hi
What I'm going to suggest is more of a hack but I think it points the way to
a long term solution.
In rkward graphs are made through a call to the function 

rk.graph.on()

This function creates graph images in the ~/.rkward folder.
It automatically names graph.01.png, graph.02.png etc. (or something very
similar)

When I make graphs now I always write code like this

rk.graph.on()
plot(x,y....)
rk.grahp.off()

The image is not actually created until rk.graph.off() is run.

I made a my own version of this command to control the size and name of the
image file I didn't go into the automatic the enumeration so it always appends
a number to the filename but it could probably be changed with some more code
digging.


a3q_rk.graph.on <- function (width = 480, height = 480,prefix="graph", ...) 
{
    filename <- rk.get.tempfile.name(prefix = prefix, extension = ".png")
    png(filename = file.path(filename), width = width, height = height, 
        ...)
    cat(paste("<img src=\"", filename, "\" width=\"", width, 
        "\" height=\"", height, "\"><br>", sep = ""), file =
rk.get.output.html.file(),
        append = TRUE)
}

It is called like this
a3q_rk.graph.on(width,height,graph_name)
plot(x,y....)
rk.grahp.off()



______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=165574




More information about the Rkward-users mailing list