DS4PS / cpp-529-fall-2020

http://ds4ps.org/cpp-529-fall-2020/
0 stars 0 forks source link

lab4-Part 2 Question 1 #14

Open malmufre opened 3 years ago

malmufre commented 3 years ago

I am trying this code to show the clusters so I can compare the groups but I am not getting any display of clusters. What could be the problem


tmap_style("cobalt")
bb <- st_bbox( c( xmin =  -10451823, xmax = -10324525, 
                  ymax = 5639769, ymin = 5491665 ), 
               crs = st_crs("+init=epsg:3395"))
tm1 <- 
tm_shape( msp_dorling, bbox=bb ) + 
  tm_polygons( col="cluster", palette="Accent"  )

tm2 <- 
tm_shape( msp_dorling, bbox=bb ) + 
  tm_polygons( col="cluster2", palette="Accent"  )

tmap_arrange( tm1, tm2)``` 
lecy commented 3 years ago

Is it a clustering problem or graphing problem?

What does your model produce?

fit <- Mclust( d3 )
summary( fit )
malmufre commented 3 years ago

Its a graphing problem I am getting an empty graph image

ekmcintyre commented 3 years ago

I am also getting empty graphs

lecy commented 3 years ago

Did you assign your new groups to your dorling object?

phx$cluster <- as.factor( fit$classification )

That is how the graphic assigns the colors: col="cluster"

tmap_mode("plot")
tmap_style("cobalt")
tm_shape( phx2, bbox=bb ) + 
  tm_polygons( col="cluster", palette="Accent"  )