简体   繁体   中英

R-Studio 0.98.507 how to plot fitted line using abline() on ascii.asc data generated through Grid raster

I am unable to draw the fitted line using abline() in R-studio.

I am using R-Studio running on windows 8.1 machine and downloaded the Landsat images for temperature analysis on LULC map. By using band 6 in Erdas Imagine, LST image was generated and imported in ArcGIS. By using 6 polygons the 6 LST raster image were generated in Grid format. By default, ArcGIS generate raster in 32bit depth data type formate. My question here is to know that Is it necessary to convert that raster to first in 8bit raster grid before converting grid to ascii file, If yes then why? if not then what is the best way to deal with conversion in R. I have myself converted that raster to ascii using ArcGIS but i cannot show any data in it rather -9999. By reading some help from stackoverflow blogs i have generated some code to convert grid to ascii.as file.The same procedure adopted for both ndvi and lst grid image.I have used the same code as written stefen on the help of stackoverflow link for code .

R showed the error message here that while running the line abline function:

Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) a and b must be finite.

Is that necessary to prepare the ascii file before getting into in R. Are is there any simple way to convert these Grid raster/tif directly into R as stefen mentioned in his code. I am also attaching lst-ascii file=1lst, ndv-ascii=2ndvi and resulted graph named Rplot01 on below mentioned links. lst and ndvi ascii files and plot image

These codes are really so helpful and self explanatory but being as a learner student of RI hope you would give some consideration to answer this question.

The answer to your question ("Is it necessary to convert that raster to first in 8bit raster grid before converting grid to ascii file, If yes then why? if not then what is the best way to deal with conversion in R.") is that you do not need to convert anything. Just use the Erdas data in REg

library(raster)
b <- brick('filename')

The abline error message you show has nothing to do with your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM