0

我正在努力将颜色编码与 Y 变量 (Lon) 和 X Var (Lat) 图中的 Z 变量 (ShipSpeedGPS.Knots.) 结合起来。

我已经通过以下命令映射了路线

NWSMAP = qmap('brunei', zoom=3)

NWSMAP + geom_point(aes(x=Lon, y=Lat), data=D3)

另外,我可以通过以下命令对没有底图的路线进行颜色编码

D3Plot = ggplot(data = D3, aes(x=Lat, y=Lon, colour=yval))

D3Plot + geom_point(aes(colour = D3$ShipSpeedGPS.Knots.))

理想情况下,我想将这两个功能组合到一个图表中。'文莱' 地图基地,路线颜色根据船只的速度进行编码。这样我就可以直观地向船长展示他们在哪些地方行驶得不必要的快并且浪费了燃料。

str(D3)
'data.frame':   74843 obs. of  15 variables:

$ Date                   : Date, format: "2015-04-27" 
$ Time                   : Factor w/ 86401 levels "","0:00:00"
$ Lat                    : num  -19.9
$ Lon                    : num  117
$ ShipCourse.Deg.        : int  182
$ ShipSpeedGPS.Knots.    : num  13.4 
$ ShipSpeedLog.Knots.    : num  13.6
$ ShipSpeedPropllr.Knots.: num  14.3
$ Wind.Dir..Rel...Deg.   : int  0
$ Wind.Speed.Abs...Knots.: num  13.3
$ WindSpeedRel...Knots.  : num  0 
$ ShaftPower.kW.         : int  7526 
$ ShaftSpeed.rpm.        : num  58.8
$ ShaftTorque.kNm.       : int  1222
$ ShaftThrust..kN.       : int  915
4

1 回答 1

0

想出了解决办法

NWSMAP2 = get_map(location = "brunei", zoom = 3)

ggmap(NWSMAP2) + geom_point(data = D3, aes(x = Lon, y = Lat, color = ShipSpeedGPS.Knots.)) + scale_colour_gradient(low="green", high="red", limits=c(10,16))
于 2015-07-16T05:08:15.823 回答