Skip to content Skip to sidebar Skip to footer

Remove Border Around Vegaembed Geoshape Generated By Altair?

In the below image, observe the border around a map generated from Chart.save() to either HTML or JSON canvas (the border is inside the canvas, not CSS styled). For any other type

Solution 1:

The way to remove the border is using configure_view(strokeWidth=0).

Here is an example, using the most recent version of Altair and the most recent version of Vega-Lite:

import altair as alt
from vega_datasets importdata

counties = alt.topo_feature(data.us_10m.url, 'counties')
source = data.unemployment.url

alt.Chart(counties).mark_geoshape().encode(
    color='rate:Q'
).transform_lookup(
    lookup='id',
    from_=alt.LookupData(source, 'id', ['rate'])
).project(
    type='albersUsa'
).configure_view(
    strokeWidth=0
)

enter image description here

If you see different results, it might be that your frontend renderer is out of date, and you should make certain you're using the most recent version of Vega-Lite to render your chart.

Post a Comment for "Remove Border Around Vegaembed Geoshape Generated By Altair?"