ImpPlot2d: 2D implicit Plot

View source: R/ImpPlot2d.R

ImpPlot2dR Documentation

2D implicit Plot

Description

Exhausively point out the data that satisfy some functions of x and y.

Usage

ImpPlot2d(func = function(x,y) abs(x^2 +2*y^2-2)<=1e-2,x = seq(from=0,to=2,by=.01),y = seq(from=0,to=2,by=.01))

Arguments

x

Author(s)

Hao Li

See Also

contour.function, ~~~ ImpPlot2d, ~~~

Examples

ImpPlot2d(func = function(x,y) abs(x^2 +2*y^2-2)<=1e-2,x = seq(from=0,to=2,by=.01),y = seq(from=0,to=2,by=.01))
#Currently defined as
#ImpPlot2d<-function(func,...) UseMethod('ImpPlot2d')
function(func, x = seq(from = -5,to = 5, by=.1),
                             y = seq(from = -5,to = 5, by=.1),
                             xlab = 'x',ylab = 'y',
                             asp = 1,col = 'red',
                             points = F){
  if(points ==F) plot(c(min(x),max(x)),c(min(y),max(y)),type = 'n',
                      asp = 1,xlab =xlab,ylab = ylab,
                      main = paste('ImpPlot of ',paste(as.character(body(func)),collapse = ' ',sep = ''),sep = ''))
    for(i in x){
      for(j in y){
        if(func(i,j)==T){
          points(i,j,col  = col)
        }
      }
    }
  message('plot completed')
}


HaoLi111/MFVN documentation built on Jan. 5, 2023, 4:37 a.m.