lovely-numpy
  1. ๐Ÿ”Ž Array Representations
  2. ๐Ÿ“Š View as a histogram
  • ๐Ÿ’Ÿ Lovely NumPy
  • ๐Ÿ”Ž Array Representations
    • ๐Ÿงพ View as a summary
    • ๐Ÿ–Œ๏ธ View as RGB images
    • ๐Ÿ“Š View as a histogram
    • ๐Ÿ“บ View channels
  • ๐Ÿ–ผ๏ธ Image utils
    • ๐ŸŽจ color mapping
    • ๐Ÿ”ฒ Pad and frame
    • ๐Ÿ Image grid
  • โœจ Misc
    • ๐Ÿ‘๏ธ Lo and behold!
    • ๐ŸŽญ Matplotlib integration
    • ๐Ÿค” Config

On this page

  • plot
  1. ๐Ÿ”Ž Array Representations
  2. ๐Ÿ“Š View as a histogram

๐Ÿ“Š View as a histogram


plot


def plot(
    x:ndarray, # Your data
    center:str='zero', # Center plot on  `zero`, `mean`, or `range`
    max_s:int=10000, # Draw up to this many samples. =0 to draw all
    plt0:Any=True, # Take zero values into account
    ax:Optional=None, # Optionally, supply your own matplotlib axes.
    ddof:int=0, # Apply bias correction to std
)->PlotProxy:
plot(np.array([]))

np.random.seed(1)
x = np.random.randn(100000)+3
plot(x)

plot(x, center="range")

plot(x-3, center="mean")

plot(np.minimum(x-3, 0))

plot(np.maximum(x-3, 0), plt0=0)

# Very large outliers - don't print all sigmas

x2 = x.copy()
x2[0] = 1000
plot(x2, center="range")

fig, (ax1,ax2) = plt.subplots(2, figsize=(6, 4))
fig.tight_layout()
plot(x, ax=ax1)
plot(np.zeros(100), ax=ax2);