:orphan: :html_theme.sidebar_secondary.remove: .. This document is auto-generated by the altair-gallery extension. Do not modify directly. .. _gallery_world_projections: World Projections ----------------- This example shows a map of the countries of the world. Use the dropdown menu to compare projections. For more details on the `project` arguments, see the API of `altair.Projection `_. .. altair-plot:: :remove-code: import altair as alt from vega_datasets import data source = alt.topo_feature(data.world_110m.url, 'countries') input_dropdown = alt.binding_select(options=[ "albers", "albersUsa", "azimuthalEqualArea", "azimuthalEquidistant", "conicEqualArea", "conicEquidistant", "equalEarth", "equirectangular", "gnomonic", "mercator", "naturalEarth1", "orthographic", "stereographic", "transverseMercator" ], name='Projection ') param_projection = alt.param(value="equalEarth", bind=input_dropdown) alt.Chart(source, width=500, height=300).mark_geoshape( fill='lightgray', stroke='gray' ).project( type=alt.expr(param_projection.name) ).add_params(param_projection) # No channel encoding options are specified in this chart # so the code is the same as for the method-based syntax. .. tab-set:: .. tab-item:: Method syntax :sync: method .. code:: python import altair as alt from vega_datasets import data source = alt.topo_feature(data.world_110m.url, 'countries') input_dropdown = alt.binding_select(options=[ "albers", "albersUsa", "azimuthalEqualArea", "azimuthalEquidistant", "conicEqualArea", "conicEquidistant", "equalEarth", "equirectangular", "gnomonic", "mercator", "naturalEarth1", "orthographic", "stereographic", "transverseMercator" ], name='Projection ') param_projection = alt.param(value="equalEarth", bind=input_dropdown) alt.Chart(source, width=500, height=300).mark_geoshape( fill='lightgray', stroke='gray' ).project( type=alt.expr(param_projection.name) ).add_params(param_projection) .. tab-item:: Attribute syntax :sync: attribute .. code:: python import altair as alt from vega_datasets import data source = alt.topo_feature(data.world_110m.url, 'countries') input_dropdown = alt.binding_select(options=[ "albers", "albersUsa", "azimuthalEqualArea", "azimuthalEquidistant", "conicEqualArea", "conicEquidistant", "equalEarth", "equirectangular", "gnomonic", "mercator", "naturalEarth1", "orthographic", "stereographic", "transverseMercator" ], name='Projection ') param_projection = alt.param(value="equalEarth", bind=input_dropdown) alt.Chart(source, width=500, height=300).mark_geoshape( fill='lightgray', stroke='gray' ).project( type=alt.expr(param_projection.name) ).add_params(param_projection) # No channel encoding options are specified in this chart # so the code is the same as for the method-based syntax.