jpng {RPMG} | R Documentation |
png or pdf output
Description
Get file name and recreate plot on a png or pdf device. This program makes an attempt to keep the same size plot as viewed in the screen.
Usage
jpng(file='tmp', width = 8, height = 8,P = NULL, bg = "white")
jpdf(file='tmp', width = 8, height = 8,P = NULL)
Arguments
file |
png or pdf: will be added as a suffix, if needed |
width |
width, inches |
height |
height, inches |
P |
vector to fix the size, c(width, height) |
bg |
background color (default="transparent") |
Details
If P=c(10,12) is missing or NULL, program will attempt to use current plotting region via par to duplicated the size of the postscript device. Must close this device with dev.off() to finish. If either w or h are provided they will override the values in vector P.
If the standard suffix (png or pdf) are provided the file will be set. If these are omitted, they will be added to the given name according to the local.file function.
Value
Graphical Side Effect
Author(s)
Jonathan M. Lees<jonathan.lees.edu>
See Also
par, postscript, device
Examples
## Not run:
jjj = local.file('hi', 'png')
x= rnorm(10)
y= rnorm(10)
plot(x,y)
print('resize the current plot')
jpng(jjj, width = 8, height = 8)
plot(x,y)
dev.off()
jpdf("HiThere.pdf", width = 8, height = 8 )
plot(x,y)
dev.off()
jpng("HiThere.png", width = 8, height = 8 , bg='red' )
plot(x,y)
dev.off()
## End(Not run)