Hi,

Maybe this could be solution for you.

m <- plotGoogleMaps(mydata, zcol="i1.a.",
                    at=3:5,
                    colPalette = c("#0066FF","#00CC00"),
                    # c("#FF0000","#FF9900","#FFFF00",
                    layerName="Some Schools",
                    filename="MyMap.html")

Best,
Milan


On Wed, Apr 30, 2014 at 6:16 PM, James Holland <holland.aggie@gmail.com>wrote:

> Yeah, I thought that might be it.
>
> Seems the other issues is when I used it with my real data, the fact I
> don't have any any lower values.  That seems to change the legend,
> replacing 0 with the lowest value and giving it the wrong color.  In this
> example, 3.2 is the lowest value.
>
> Thank you for your help.
>
> ~James
>
> See code below.
>
> #  Messing around with Student Engagement Survey data
> library(RgoogleMaps)
> library(PBSmapping)
> library(maptools)
> library(reshape)
> library(RColorBrewer)
> library(plotGoogleMaps)
> library(rgdal)
>
> rm(list=ls())
>
>
> mydata <- data.frame(NAME=c("James Elem","Chloe MS","Logan HS", "Kristen
> Elem", "Heather HS", "Nora MS", "Elizabeth JH"),
>                    i1.a.=c(3.2,4,3.4, 4.4, 3.5, 4.3, 4.9),
>    lat = c(32.968, 32.874, 32.884, 32.91538, 32.91810, 32.87884, 32.94468),
>    lon = c(-96.692, -96.725, -96.708, -96.72321, -96.71760, -96.73990,
> -96.72850)
>    )
>
>
>
> # ------------------------------- #
>
>
> # --------------------------------------- #
> # -- Ploting School Locations ----------- #
>
> coordinates(mydata) <- ~lon + lat
> proj4string(mydata) <- CRS("+proj=longlat +datum=WGS84")
>
> #SchoolRaceP <- SpatialPointsDataFrame, data
>
> # Playing around with various options
>
> m <- plotGoogleMaps(mydata, zcol="i1.a.",
>  at=0:5,
> colPalette = c("#FF0000","#FF9900","#FFFF00","#0066FF","#00CC00"),
>  layerName="Some Schools",
>                     filename="MyMap.html")
>
>
> On Wed, Apr 30, 2014 at 2:00 AM, Milan Kilibarda <milan.kili11@gmail.com>wrote:
>
>> Hi,
>>
>> Just set at correctly in your case at should be 0:5 . You should have one
>> more breaks than colors.
>>
>>  cut(mydata$i1.a., 0:5, include.lowest=T)
>>
>> [1] [0,1] [0,1] (1,2] (2,3] (3,4] (4,5] (4,5]
>> Levels: [0,1] (1,2] (2,3] (3,4] (4,5]
>>
>> so,
>>
>> m <- plotGoogleMaps(mydata, zcol="i1.a.",
>>                     at=0:5,
>>                     colPalette =
>> c("#FF0000","#FF9900","#FFFF00","#0066FF","#00CC00"),
>>                     layerName="Some Schools",
>>                     filename="MyMap.html")
>>
>> works good
>>
>> Best,
>> Milan
>>
>>
>> On Tue, Apr 29, 2014 at 10:45 PM, James Holland <holland.aggie@gmail.com>wrote:
>>
>>> I cannot get the legend to display the cut points I want correctly.
>>> Instead of doing the colors at 1, 2, 3, 4, 5 - its doing the color breaks
>>> at odd points on the legends.  The labels seem to get coded correctly
>>> however.
>>>
>>> #   Code Below
>>>
>>>
>>> #----------------------------------------------------------------------------------------.
>>>
>>> #  Messing around with Student Engagement Survey data
>>> library(RgoogleMaps)
>>> library(PBSmapping)
>>> library(maptools)
>>> library(reshape)
>>> library(RColorBrewer)
>>> library(plotGoogleMaps)
>>> library(rgdal)
>>>
>>> rm(list=ls())
>>>
>>> mydata <- data.frame(NAME=c("James Elem","Chloe MS","Logan HS", "Kristen
>>> Elem", "Heather HS", "Nora MS", "Elizabeth JH"),
>>>                    i1.a.=c(0,1,2, 2.4, 3.5, 4.3, 5),
>>>    lat = c(32.968, 32.874, 32.884, 32.91538, 32.91810, 32.87884,
>>> 32.94468),
>>>    lon = c(-96.692, -96.725, -96.708, -96.72321, -96.71760, -96.73990,
>>> -96.72850)
>>>    )
>>>
>>>
>>>
>>> # ------------------------------- #
>>>
>>>
>>> # --------------------------------------- #
>>> # -- Ploting School Locations ----------- #
>>>
>>> coordinates(mydata) <- ~lon + lat
>>> proj4string(mydata) <- CRS("+proj=longlat +datum=WGS84")
>>>
>>> #SchoolRaceP <- SpatialPointsDataFrame, data
>>>
>>> # Playing around with various options
>>>
>>> m <- plotGoogleMaps(mydata, zcol="i1.a.",
>>> at=0:4,
>>> colPalette = c("#FF0000","#FF9900","#FFFF00","#0066FF","#00CC00"),
>>> layerName="Some Schools",
>>>                     filename="MyMap.html")
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>>
>>
>> --
>> Dr. Milan Kilibarda
>> Assistant professor
>> University of Belgrade,
>> Faculty of Civil Engineering,
>> Department of Geodesy and Geoinformatics,
>> Address: Bulevar kralja Aleksandra 73  11000 Belgrade, Serbia,
>> Mail:  kili@grf.bg.ac.rs
>> Web: http://dailymeteo.org/
>> Pub: http://scholar.google.com/citations?user=Zl2MZ3AAAAAJ&hl=en
>> tel:+381 11 3218630
>>
>
>


-- 
Dr. Milan Kilibarda
Assistant professor
University of Belgrade,
Faculty of Civil Engineering,
Department of Geodesy and Geoinformatics,
Address: Bulevar kralja Aleksandra 73  11000 Belgrade, Serbia,
Mail:  kili@grf.bg.ac.rs
Web: http://dailymeteo.org/
Pub: http://scholar.google.com/citations?user=Zl2MZ3AAAAAJ&hl=en
tel:+381 11 3218630

	[[alternative HTML version deleted]]

