In [1]:
from ahh import vis, exp
import matplotlib.pyplot as plt # to show equivalent
In [2]:
x = exp.arr_1d() * 2
y = exp.arr_1d(y=True) # create random data
print(x)
print(y) # reference
In [3]:
plt.plot(y) # equivalent to one directly below
Out[3]:
In [4]:
ax = vis.plot_line(y) # simplest usage, just input y
In [5]:
plt.scatter(x, y) # equivalent to one directly below
plt.xlabel('x')
plt.ylabel('y')
plt.title('Example')
plt.xlim(-1, 31)
plt.ylim(0, 14)
Out[5]:
Out[5]:
Out[5]:
Out[5]:
Out[5]:
Out[5]:
In [6]:
vis.plot_scatter(x, y, xlabel='x', ylabel='y', title='Example', xlim=(-1, 31), ylim=(0, 14)) # input x, add labels and limits
Out[6]:
In [7]:
x = exp.arr_dt().to_pydatetime() # random datetimes
y2 = exp.arr_1d(y=True)
print(x, y2)
In [8]:
plt.plot(x, y, label='Blue', linestyle='--')
plt.legend() # equivalent to below
Out[8]:
Out[8]:
In [9]:
vis.plot_line(x, y, label='Red', linestyle='--') # label and legend automatically shows
Out[9]:
In [17]:
x = exp.arr_1d()
y2 = exp.arr_1d(y=True)
vis_dict = dict(rows=2, # specify number of subplots
sidebar_count=2, # specify number of side by side bars
xlabel='x', title='Vis Demonstration', suptitle=True,
title_pad=0.9, figsize='na')
vis.set_figsize(15, 8) # set figure size
vis.plot_bar(x, y, label='Red Bars', ylabel='Values', **vis_dict)
vis.plot_bar(x, y2, label='Blue Bars', sidebar_pos=2, color='blue', **vis_dict)
vis.plot_hist(['Chicken'] * 5 + ['Egg'] * 2 + ['Spam'], # random data
rows=2, pos=2, ptype='bar',
ylabel='Count', color='orange', # labels and color
cumsum=True) # get cumulative count
Out[17]:
Out[17]:
Out[17]:
In [ ]: