Thank you very much Paul. This is the data frame that I created
> head(riquezakrig_df) band1 band2 band3 x y 269 1.760396 1.620212 1.272875 460590.1 1216391 1686 1.760396 1.620212 1.272875 460540.1 1216341 1687 1.760396 1.620212 1.272875 460590.1 1216341 3103 1.760396 1.620212 1.272875 460490.1 1216291 3104 1.760396 1.620212 1.272875 460540.1 1216291 3105 1.760396 1.620212 1.272875 460590.1 1216291 You suggest to make a new column with the color, but I don't understand which information should I provide to the new column. Best, Manuel On 07/11/2010 04:00 a.m., Paul Hiemstra wrote: > Hi Manuel, > > Please do not respond to me alone, include the mailing list in the cc. > You waste the option of someone else answering your question and the > answers are not stored in the archives for other people. > > But back to your question. The tiff file has 3 bands, rgb bands. > Probably the contents in those bands is a number between 0 and 255, > but you do not specify this in your mail. In this case the tiff file > does not contain the 'real' values but is a picture. So drawing > individual bands does not make sense. What you could try is to > construct a new column in the dataset with the color and try to use in > the aes() argument (col = col, where col is the name of the column > with the color). > > cheers, > Paul > > > On 11/06/2010 03:03 PM, Paul Hiemstra wrote: >> Gpplot cannot plot SpatialPixelsDataFrame's in one go. You need to >> convert the grid to a data frame. >> >> An example using the meuse dataset: >> >> library(sp) >> library(ggplot2) >> data(meuse.grid) >> gridded(meuse.grid) = ~x+y >> summary(meuse.grid) >> >> meuse.grid_df = as(meuse.grid, "data.frame") >> >> # Now make a plot with ggplot >> p = ggplot(aes(x = x, y = y, fill = dist), data = meuse.grid_df) + >> geom_tile() >> print(p) >> >> # Add some tricks specially suitable for >> # spatial plots >> print(p + >> scale_x_continuous('', labels = NA, breaks = NA) + >> scale_y_continuous('', labels = NA, breaks = NA) + >> opts(aspect.ratio = 1, alpha = 0.5)) >> >> cheers, >> Paul >> >> On 11/06/2010 02:28 PM, Manuel Spínola wrote: >> >>> Thank you very much Paul. >>> >>> With plot I got a black polygon and with spplpot I got: >>> >>> >>>> spplot(riquezakrig) >>>> >>> Error: cannot allocate vector of size 22.6 Mb >>> >>> with image show me what I want but no legend. >>> >>> Any specific geom to plot with ggplot? >>> >>> Best, >>> >>> Manuel >>> >>> On 06/11/2010 06:46 a.m., Paul Hiemstra wrote: >>> >>>> On 11/06/2010 11:15 AM, Manuel Spínola wrote: >>>> >>>>> Dear list members, >>>>> >>>>> I read a .tif file with readGDAL. >>>>> What is the best way to display it?. >>>>> >>>>> >>>> spplot or ggplot >>>> >>>>> I tried function image but there is no legend. >>>>> >>>>> >>>> true >>>> >>>>> I tried plot and spplot but I couldn't get them to work. >>>>> >>>>> >>>> why not? What error? What version of R and sp? You're not giving us >>>> any information that could give us a clue to what's going wrong. >>>> >>>> cheers, >>>> Paul >>>> >>>>> Any help will be appreciated. >>>>> >>>>> Best, >>>>> >>>>> Manuel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> R-sig-Geo mailing list >>>>> R-sig-Geo@stat.math.ethz.ch >>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >>>>> >>>>> >>>> -- >>>> Drs. Paul Hiemstra >>>> Department of Physical Geography >>>> Faculty of Geosciences >>>> University of Utrecht >>>> Heidelberglaan 2 >>>> P.O. Box 80.115 >>>> 3508 TC Utrecht >>>> Phone: +3130 253 5773 >>>> http://intamap.geo.uu.nl/~paul >>>> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 >>>> >>> -- >>> *Manuel Spínola, Ph.D.* >>> Instituto Internacional en Conservación y Manejo de Vida Silvestre >>> Universidad Nacional >>> Apartado 1350-3000 >>> Heredia >>> COSTA RICA >>> mspin...@una.ac.cr >>> mspinol...@gmail.com >>> Teléfono: (506) 2277-3598 >>> Fax: (506) 2237-7036 >>> Personal website: Lobito de río >>> <https://sites.google.com/site/lobitoderio/> >>> Institutional website: ICOMVIS<http://www.icomvis.una.ac.cr/> >>> >> >> >> >> _______________________________________________ >> R-sig-Geo mailing list >> R-sig-Geo@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> > > > -- > Drs. Paul Hiemstra > Department of Physical Geography > Faculty of Geosciences > University of Utrecht > Heidelberglaan 2 > P.O. Box 80.115 > 3508 TC Utrecht > Phone: +3130 253 5773 > http://intamap.geo.uu.nl/~paul > http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 -- *Manuel Spínola, Ph.D.* Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspin...@una.ac.cr mspinol...@gmail.com Teléfono: (506) 2277-3598 Fax: (506) 2237-7036 Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/> [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo