:orphan: :html_theme.sidebar_secondary.remove: .. This document is auto-generated by the altair-gallery extension. Do not modify directly. .. _gallery_scatter_tooltips: Simple Scatter Plot with Tooltips --------------------------------- A scatter plot of the cars dataset, with tooltips showing selected column values when you hover over points. We make the points larger so that it is easier to hover over them. .. altair-plot:: :remove-code: import altair as alt from vega_datasets import data source = data.cars() alt.Chart(source).mark_circle(size=60).encode( x='Horsepower', y='Miles_per_Gallon', color='Origin', tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon'] ).interactive() # No channel encoding options are specified in this chart # so the code is the same as for the method-based syntax. .. tab-set:: .. tab-item:: Method syntax :sync: method .. code:: python import altair as alt from vega_datasets import data source = data.cars() alt.Chart(source).mark_circle(size=60).encode( x='Horsepower', y='Miles_per_Gallon', color='Origin', tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon'] ).interactive() .. tab-item:: Attribute syntax :sync: attribute .. code:: python import altair as alt from vega_datasets import data source = data.cars() alt.Chart(source).mark_circle(size=60).encode( x='Horsepower', y='Miles_per_Gallon', color='Origin', tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon'] ).interactive() # No channel encoding options are specified in this chart # so the code is the same as for the method-based syntax.