1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
.. currentmodule:: altair
.. _user-guide-tick-marks:
Tick
~~~~
The ``tick`` mark represents each data point as a short line. This is a useful mark for displaying the distribution of values in a field.
Tick Mark Properties
--------------------
A ``tick`` mark definition can contain any :ref:`standard mark properties <mark-properties>`
and the following special properties:
.. altair-object-table:: altair.MarkDef
:properties: cornerRadius orient
Examples
--------
Dot Plot
^^^^^^^^
The following dot plot uses tick marks to show the distribution of precipitation in Seattle.
.. altair-plot::
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
alt.Chart(source).mark_tick().encode(
x="precipitation:Q"
)
Strip Plot
^^^^^^^^^^
By adding a ``y`` field, a strip plot can be created that shows the distribution of horsepower by number of cylinders.
.. altair-plot::
import altair as alt
from vega_datasets import data
source = data.cars()
alt.Chart(source).mark_tick().encode(
x="Horsepower:Q",
y="Cylinders:O",
)
Customizing Tick’s Size and Thickness
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. altair-plot::
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
alt.Chart(source).mark_tick().encode(
x="precipitation:Q"
).configure_tick(
thickness=2,
bandSize=10,
)
|