Urban Residents 동네와 예술 작품 시각화
이제 대부분의 예술 작품이 Urban Residents 동네에 있다는 것을 알게 되었어요. 이번 연습에서는 그 동네의 예술 작품을 시각화해 보겠습니다. 먼저 neighborhood_art에서 urban_art만 추려내고, neighborhoods에서 urban_polygon을 추려냅니다. 그런 다음 다각형을 ax로 먼저 그린 뒤, 예술 작품 점을 추가로 그립니다.
이 연습은 강의의 일부입니다
Python으로 지리공간 데이터 시각화하기
연습 안내
.loc[]접근자를 사용해"Urban Residents"동네에 있는 작품만 가져와urban_art라는 GeoDataFrame을 만드세요.- 다시
.loc[]를 사용해neighborhoods에서"Urban Residents"폴리곤만 포함하는urban_polygonGeoDataFrame을 만드세요. urban_polygon을ax로 그리면서color를lightgreen으로 설정하세요.urban_art의 작품을 그리세요. 인수는 세 가지를 전달합니다: 이 플롯을urban_polygon위에 추가하려면ax = ax를 지정하고, 점에 레이블을 붙이기 위해type을 사용하며,legend = True로 설정하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Create urban_art from neighborhood_art where the neighborhood name is Urban Residents
urban_art = neighborhood_art.loc[neighborhood_art.name == ____]
# Get just the Urban Residents neighborhood polygon and save it as urban_polygon
urban_polygon = neighborhoods.loc[____.____ == "Urban Residents"]
# Plot the urban_polygon as ax
ax = ____.____(color = 'lightgreen')
# Add a plot of the urban_art and show it
urban_art.plot( ax = ax, ____ = 'type', legend = True);
plt.show()