r语言报错|Error in plot.window(...) : ‘xlim‘值不能是无限的

plot()绘制图层时报错

错误提示:

Error in plot.window(...) : 'xlim'值不能是无限的
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

原因:数据中含有空值

解决办法:

 na.omit(数据名)