
:orphan:
:html_theme.sidebar_secondary.remove:

.. This document is auto-generated by the altair-gallery extension. Do not modify directly.

.. _gallery_gapminder_bubble_plot:


Gapminder Bubble Plot
=====================
This example shows how to make a bubble plot showing the correlation between
health and income for 187 countries in the world (modified from an example
in Lisa Charlotte Rost's blog post `'One Chart, Twelve Charting Libraries' <http://lisacharlotterost.github.io/2016/05/17/one-chart-code/>`_.


.. altair-plot::
    :remove-code:
    


    import altair as alt
    from altair.datasets import data

    source = data.gapminder_health_income.url

    alt.Chart(source).mark_circle().encode(
        alt.X('income:Q', scale=alt.Scale(type='log')),
        alt.Y('health:Q', scale=alt.Scale(zero=False)),
        size='population:Q'
    )


.. tab-set::

    .. tab-item:: Method syntax
        :sync: method

        .. code:: python


            import altair as alt
            from altair.datasets import data

            source = data.gapminder_health_income.url

            alt.Chart(source).mark_circle().encode(
                alt.X('income:Q').scale(type='log'),
                alt.Y('health:Q').scale(zero=False),
                size='population:Q'
            )


    .. tab-item:: Attribute syntax
        :sync: attribute

        .. code:: python


            import altair as alt
            from altair.datasets import data

            source = data.gapminder_health_income.url

            alt.Chart(source).mark_circle().encode(
                alt.X('income:Q', scale=alt.Scale(type='log')),
                alt.Y('health:Q', scale=alt.Scale(zero=False)),
                size='population:Q'
            )
