LoginSignup
10

More than 5 years have passed since last update.

Rでプロット点に画像を使う

Last updated at Posted at 2013-01-14

例として、R本体に含まれているロゴをjpegパッケージを使って読み込み、rasterImage()関数で表示させてみます。

code
library(jpeg)
jpegPath <- paste(R.home(),"/doc/html/logo.jpg",sep="")
image <- readJPEG(jpegPath)

plot(cars)

cars

rasterImage(image, 
            cars$speed-0.5, cars$dist-2.5, cars$speed+0.5, cars$dist+2.5)

cars2

このロゴ大好きなんですけどさすがにこんな並んでると精神が不安定になりますね。


gridパッケージを使う場合はこのあたりをどうぞ。
http://stackoverflow.com/questions/14102655/users-own-pch-clip-in-r

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10