https://blog.csdn.net/weixin_45534890/article/details/108089035
1. 读入并展示PNG
读入图片:
readPNG(source=)
source=
: 图片绝对路径和图片名
展示图片:
rasterImage(image=, xleft=, ybottom=, xright=, ytop=, angle=)
image=
: 读入图片后生成的图片数据
xleft=
: 图片左下角横坐标
ybottom=
: 图片左下角纵坐标
xright=
: 图片右上角横坐标
ytop=
: 图片右上角纵坐标
angle=
: 图片旋转角度
pp <- readPNG(source="/home/zhiyong/Pictures/14.png") '#读入.png格式的图片,生成的变量是三维数组
r <- nrow(pp)/ncol(pp) #计算图片的长宽比
plot(c(0,1),c(0,r),type = "n",asp=1) #绘制坐标轴,示例一
rasterImage(pp,0,0,1,0.6, angle = 0) #绘制图片,示例二


网友评论