Charting#
chart keywords#
ahlive has these keywords for various types of charts:
ahlive keyword |
description |
---|---|
|
connect data coordinates with a line |
|
mark data coordinates with symbols |
|
fill data coordinates with vertical rectangles |
|
fill data coordinates with horizontal rectangles |
|
fill data arrays with fractional wedges |
|
connect data coordinates with a line plus segments |
|
fill data coordinates with regions |
|
label data coordinates with text |
|
paints data grids with filled colors |
|
contour data grids with filled colors |
|
contour data grids with line colors |
|
groups data grids as 2D histograms |
|
draws data grids as arrows |
|
draws data grids as streamlines |
|
draws data grid as wind barbs |
A chart
’s behavior may be modified by setting a preset
. Learn more in Presetting.
line#
Draws a line, segment by segment, connecting the data points.
[1]:
import ahlive as ah
ah.Array([-5, 0, 5], [1, -1, 0.5], xlims="fixed", chart="line").render()
gifsicle: warning: trivial adaptive palette (only 140 colors in source)
[1]:
scatter#
Draws a symbol that moves one coordinate point at a time.
[2]:
import ahlive as ah
ah.Array([-5, 0, 5], [1, -1, 0.5], xlims="fixed", chart="scatter").render()
gifsicle: warning: trivial adaptive palette (only 48 colors in source)
[2]:
bar#
Draws bars, fusing the data points.
[3]:
import ahlive as ah
ah.Array([-5, 0, 5], [1, -1, 0.5], xlims="fixed", chart="bar").render()
gifsicle: warning: trivial adaptive palette (only 17 colors in source)
[3]:
barh#
Same as bar
, but horizontally.
[4]:
import ahlive as ah
ah.Array([-5, 0, 5], [1, -1, 0.5], xlims="fixed", chart="barh").render()
gifsicle: warning: trivial adaptive palette (only 16 colors in source)
[4]:
pie#
Draws a fractionated circle with the area representing the data points.
[5]:
import ahlive as ah
ah.Array([0.5, 0.75, 1], chart="pie").render()
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast
gifsicle: warning: trivial adaptive palette (only 153 colors in source)
[5]:
If both xs
and ys
are passed, xs
will be ignored.
errorbar#
Like line
, but with vertical or horizontal segments at each base frame.
[6]:
import ahlive as ah
ah.Array(
[0, 1, 2],
[1, 2, 3],
yerrs=[0.25, 0.5, 0.1],
xlims="fixed",
chart="errorbar",
).render()
gifsicle: warning: trivial adaptive palette (only 137 colors in source)
[6]:
area#
Fills in regions, step by step.
[7]:
import ahlive as ah
ah.Array(
[0, 1, 2],
[3, 2, 1.5],
y2=[2, 1.5, 1.5],
xlims="fixed",
chart="area",
).render()
gifsicle: warning: trivial adaptive palette (only 172 colors in source)
[7]:
annotation#
Have a label follow data coordinates.
[8]:
import ahlive as ah
ah.Array(
[0, 1, 2],
[1, 2, 1.5],
text=["a", "b", "c"],
xlims="fixed",
chart="annotation"
).render()
gifsicle: warning: trivial adaptive palette (only 22 colors in source)
[8]:
pcolormesh#
Maps color to each grid cell based on the value.
[9]:
import ahlive as ah
import numpy as np
xs, ys = np.arange(0, 2 * np.pi, .5), np.arange(0, 2 * np.pi, .5)
X, Y = np.meshgrid(xs, ys)
cs = np.stack([np.sin(X), np.cos(X)]) * np.stack([np.sin(Y), np.sin(Y)])
ah.Array2D(xs, ys, cs=cs, chart="pcolormesh").render()
gifsicle: warning: trivial adaptive palette (only 60 colors in source)
[9]: