<commit_before>"""
Natural Disasters
-----------------
This example shows a visualization of global deaths from natural disasters.
"""
# category: case studies
import altair as alt
from vega_datasets import data

source = data.disasters.url

alt.Chart(source).mark_circle(
    opacity=0.8,
    stroke='black',
    strokeWidth=1
).encode(
    alt.X('Year:O', axis=alt.Axis(labelAngle=0)),
    alt.Y('Entity:N'),
    alt.Size('Deaths:Q',
        scale=alt.Scale(range=[0, 4000]),
        legend=alt.Legend(title='Annual Global Deaths')
    ),
    alt.Color('Entity:N', legend=None)
).properties(
    width=450,
    height=320
).transform_filter(
    alt.datum.Entity != 'All natural disasters'
)<commit_msg>Update natural_disasters.py<commit_after>"""
Global Deaths from Natural Disasters
------------------------------------
This example shows a proportional symbols visualization of deaths from natural disasters by year and type.
"""
# category: case studies
import altair as alt
from vega_datasets import data

source = data.disasters.url

alt.Chart(source).transform_filter(
    alt.datum.Entity != 'All natural disasters'
).mark_circle(
    opacity=0.8,
    stroke='black',
    strokeWidth=1,
    strokeOpacity=0.4
).encode(
    x=alt.X('Year:O', axis=alt.Axis(labelAngle=0)),
    y=alt.Y('Entity:N', sort=alt.EncodingSortField(field="Deaths", op="sum", order='descending')),
    size=alt.Size('Deaths:Q',
        scale=alt.Scale(range=[0, 2500]),
        legend=alt.Legend(title='Deaths')
    ),
    color=alt.Color('Entity:N', legend=None),
    tooltip=["Entity:N", "Year:O", "Deaths:Q"]
).properties(
    width=450,
    height=320,
    title="Global Deaths from Natural Disasters"
).configure_axisX(
    labelOverlap=True
).configure_view(
    stroke=None
)
{'fraction_non_alphanumeric': 0.1712018140589569, 'fraction_numerical': 0.018140589569160998, 'mean_word_length': 3.6941489361702127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2870536', 'n_tokens_mistral': 591, 'n_tokens_neox': 560, 'n_words': 125}