import termplotlib as tpl
import numpy as np
= np.linspace(0, 2 * np.pi, 10)
x = np.sin(x) y
import termplotlib as tpl
import numpy as np
= np.random.default_rng(123)
rng = rng.standard_normal(size=1000)
sample = np.histogram(sample)
counts, bin_edges
= tpl.figure()
fig ="horizontal", force_ascii=False)
fig.hist(counts, bin_edges, orientation fig.show()
-3.30e+00 - -2.66e+00 [ 8] █▎
-2.66e+00 - -2.03e+00 [ 22] ███▌
-2.03e+00 - -1.39e+00 [ 50] ████████
-1.39e+00 - -7.56e-01 [123] ███████████████████▋
-7.56e-01 - -1.20e-01 [236] █████████████████████████████████████▊
-1.20e-01 - +5.16e-01 [250] ████████████████████████████████████████
+5.16e-01 - +1.15e+00 [172] ███████████████████████████▌
+1.15e+00 - +1.79e+00 [111] █████████████████▊
+1.79e+00 - +2.42e+00 [ 22] ███▌
+2.42e+00 - +3.06e+00 [ 6] █
import termplotlib as tpl
= tpl.figure()
fig 3, 10, 5, 2], ["Cats", "Dogs", "Cows", "Geese"], force_ascii=True)
fig.barh([ fig.show()
Cats [ 3] ************
Dogs [10] ****************************************
Cows [ 5] ********************
Geese [ 2] ********
import termplotlib as tpl
import numpy as np
= np.random.default_rng(123)
rng = rng.standard_normal(size=1000)
sample = np.histogram(sample, bins=40)
counts, bin_edges = tpl.figure()
fig =[15, 25], force_ascii=False)
fig.hist(counts, bin_edges, grid fig.show()
▇ █
▁ █ ▁█ ▄
█ █▂██▁█
█▅██████ ▄▄
▃████████▃██ ▆
█████████▉██▇█
▅▅▇█████████▉████▁▅
▂██▉█████████▉██████▃
▃▁ ▅▇███▉█████████▉███████
▂ ▂▄ ▄████████▉█████████▉████████▆▄▅▃▂ ▁