:orphan:
:html_theme.sidebar_secondary.remove:
.. This document is auto-generated by the altair-gallery extension. Do not modify directly.
.. _gallery_multifeature_scatter_plot:
Multifeature Scatter Plot
=========================
This example shows how to make a scatter plot with multiple feature encodings.
.. altair-plot::
:remove-code:
import altair as alt
from altair.datasets import data
source = data.penguins()
alt.Chart(source).mark_circle().encode(
alt.X('Flipper Length (mm)', scale=alt.Scale(zero=False)),
alt.Y('Body Mass (g)', scale=alt.Scale(zero=False, padding=1)),
alt.Size('Beak Depth (mm)', scale=alt.Scale(zero=False)),
color='Species'
)
.. tab-set::
.. tab-item:: Method syntax
:sync: method
.. code:: python
import altair as alt
from altair.datasets import data
source = data.penguins()
alt.Chart(source).mark_circle().encode(
alt.X('Flipper Length (mm)').scale(zero=False),
alt.Y('Body Mass (g)').scale(zero=False, padding=1),
alt.Size('Beak Depth (mm)').scale(zero=False),
color='Species'
)
.. tab-item:: Attribute syntax
:sync: attribute
.. code:: python
import altair as alt
from altair.datasets import data
source = data.penguins()
alt.Chart(source).mark_circle().encode(
alt.X('Flipper Length (mm)', scale=alt.Scale(zero=False)),
alt.Y('Body Mass (g)', scale=alt.Scale(zero=False, padding=1)),
alt.Size('Beak Depth (mm)', scale=alt.Scale(zero=False)),
color='Species'
)