: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 vega_datasets import data
source = data.iris()
alt.Chart(source).mark_circle().encode(
alt.X('sepalLength', scale=alt.Scale(zero=False)),
alt.Y('sepalWidth', scale=alt.Scale(zero=False, padding=1)),
color='species',
size='petalWidth'
)
.. tab-set::
.. tab-item:: Method syntax
:sync: method
.. code:: python
import altair as alt
from vega_datasets import data
source = data.iris()
alt.Chart(source).mark_circle().encode(
alt.X('sepalLength').scale(zero=False),
alt.Y('sepalWidth').scale(zero=False, padding=1),
color='species',
size='petalWidth'
)
.. tab-item:: Attribute syntax
:sync: attribute
.. code:: python
import altair as alt
from vega_datasets import data
source = data.iris()
alt.Chart(source).mark_circle().encode(
alt.X('sepalLength', scale=alt.Scale(zero=False)),
alt.Y('sepalWidth', scale=alt.Scale(zero=False, padding=1)),
color='species',
size='petalWidth'
)