Функция plotly.express.scatter_geo () в Python
Библиотека Plotly Python может быть очень полезной для визуализации данных и понимания данных просто и легко. Объекты графического представления представляют собой высокоуровневый интерфейс для построения графиков, который прост в использовании.
функция plotly.express.scatter_geo ()
Эта функция используется для нанесения географических данных на карты.
Syntax: plotly.express.scatter_geo(data_frame=None, lat=None, lon=None, locations=None, locationmode=None, color=None, text=None, hover_name=None, hover_data=None, custom_data=None, size=None, title=None, template=None, width=None, height=None)
Parameters:
data_frame: DataFrame or array-like or dict needs to be passed for column names.
lat: This parameter is used to position marks according to latitude on a map.
lon: This parameter is used to position marks according to longitude on a map.
locations: This parameter is interpreted according to locationmode and mapped to longitude/latitude.
locationmode: This parameter determines the set of locations used to match entries in locations to regions on the map.
color: This parameters assign color to marks.
size: This parameter is used to assign mark sizes. It is either a name of a column in data_frame, or a pandas Series or array_like object.
title: This parameter sets the title of the figure.
width: This parameter sets the width of the figure
height: This parameter sets the height of the figure.
Example 1:
Python3
import plotly.express as px df = px.data.gapminder().query( "year == 2007" ) plot = px.scatter_geo(df, locations = "iso_alpha" ) plot.show() |
Выход:
Example 2: Using the size and color argument
Python3
import plotly.express as px df = px.data.gapminder().query( "year == 2007" ) plot = px.scatter_geo(df, locations = "iso_alpha" , size = "gdpPercap" , color = "country" ) plot.show() |
Выход:
Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.
Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.