X-Y plot

dat<-read.csv("datafile_r101_01.csv")
with(dat,{
  plot(x=lon,y=lat,
       pch=19,
       cex=pm25*0.3,
       col=rgb(1,0,0,0.3),
       xlim=c(126,130),
       ylim=c(35,38),
       xlab="longitude",
       ylab='lattitue')
  text(x=lon,y=lat,labels=city)
})

WorldCloud

install.packages('wordcloud')
library(wordcloud,quietly = TRUE)
## Warning: package 'wordcloud' was built under R version 4.0.4
with(dat,{
  wordcloud(city,freq=pm25,colors=rainbow(3),random.color=TRUE)
})

Image Processing - 1

install.packages("imager")
library(imager)
## Warning: package 'imager' was built under R version 4.0.4
## Loading required package: magrittr
## 
## Attaching package: 'imager'
## The following object is masked from 'package:magrittr':
## 
##     add
## The following objects are masked from 'package:stats':
## 
##     convolve, spectrum
## The following object is masked from 'package:graphics':
## 
##     frame
## The following object is masked from 'package:base':
## 
##     save.image
img_path='img_r101_01.png'
img=load.image(img_path)
plot(img)

img=resize(img,
           size_x=400,
           size_y=400)
plot(img,xlim=c(0,400),ylim=c(0,400))

angle=0
while(angle<90) {
  angle=angle+30
  newimg=imrotate(img,angle,cx=200,cy=200)
  plot(newimg,axes=FALSE,)
}

rm(angle,newimg)

Image Processing - 2

im <- load.image("parrots.png")
plot(im)

save.image(im,'new_parrots.png',quality=1)
plot(
  isoblur(im,sigma=10)
)

plot(
  deriche(im,sigma=2,order=2,axis='x') #edge detection along x-axis
)

newim<-im %>%
  deriche(sigma=2,order=2,axis='x') %>%
  deriche(sigma=2,order=2,axis='y')
plot(newim)

suppressWarnings({
  im %>%
    cannyEdges(alpha=0.6) %>%
    plot()
})

load.image('boat.jpg') %>%
  resize_halfXY() %>%
  plot()

load.image('boat.jpg') %>%
  resize_halfXY() %>%
  deriche(sigma=2,order=2) %>%
  cannyEdges() %>%
  plot()
## Warning in cannyEdges(.): Running Canny detector on luminance channel