Skip to content

Maps

Here we'll talk about how to plot some maps in DEX using dx.

Setup

We will be using our own built-in DataFrame generation function for these visualizations. The values you see may be different if you run the same code in a cell, but the column structure should be very similar (if not identical).

df = dx.random_dataframe(100)

The Customized examples with more options do not necessarily represent "good" data visualization; they are just a glimpse into what settings are available to compare against the Simple examples.

Choropleth

Coming soon!

Tilemap

Since dx.random_dataframe() returns integer_column values (-100 to 100) and float_column values (0.0 to 1.0) as the only numeric columns by default, we can suggest enabling the lat_float_column and lon_float_column arguments for some quick testing:

df = dx.random_dataframe(100, lat_float_column=True, lon_float_column=True)

More about how Noteable builds with Mapbox here. 🗺️

Simple

dx.tilemap(df, lon='lon_float_column', lat='lat_float_column')

df.plot(kind='tilemap', lon='lon_float_column', lat='lat_float_column')
*Note you can't use df.plot.tilemap() directly

Customized

dx.tilemap(
    df,
    lat='lat_float_column',
    lon='lon_float_column',
    icon_opacity=0.5,
    icon_size='index',
    icon_size_scale="log",
    stroke_color="magenta",
    stroke_width=5,
    label_column='bytes_column',
    tile_layer="light",
    hover_cols=['keyword_column', 'datetime_column'],
)

df.plot(
    kind='tilemap',
    lat='lat_float_column',
    lon='lon_float_column',
    icon_opacity=0.5,
    icon_size='index',
    icon_size_scale="log",
    stroke_color="magenta",
    stroke_width=5,
    label_column='bytes_column',
    tile_layer="light",
    hover_cols=['keyword_column', 'datetime_column'],
)
*Note you can't use df.plot.tilemap() directly