histf

Simply produce histograms formatted the way you like them.
4.8K Downloads
Updated 15 Aug 2014

View License

This function plots formatted histograms. It's similar to hist, but with more options for FaceColor, BarWidth, LineStyle, FaceAlpha, etc.

Syntax
histf(Y)
histf(Y,x)
histf(Y,nbins)
histf(...,'BarWidth',BarWidth)
histf(...,'FaceColor',FaceColor)
histf(...,'EdgeColor',EdgeColor)
histf(...,'LineStyle',LineStyle)
histf(...,'LineWidth',LineWidth)
histf(...,'FaceAlpha',FaceAlpha)
histf(...,'EdgeAlpha',EdgeAlpha)
histf(...,'Alpha',Alpha)
[n,xout,h] = histf(...)

Description
histf(Y) bins the elements in vector Y into 10 equally spaced containers and returns the number of elements in each container as a row vector. If Y is an m-by-p matrix, histf treats the columns of Y as vectors. No elements of Y can be complex or of type integer.

histf(Y,x) where x is a vector, returns the distribution of Y among length(x) bins with centers specified by x. For example, if x is a 5-element vector, histf distributes the elements of Y into five bins centered on the x-axis at the elements in x, none of which can be complex.

histf(Y,nbins) where nbins is a scalar, uses nbins number of bins.

histf(...,'BarWidth',BarWidth) specifies the width of bars as a fraction of total space available for each bar. Default BarWidth is 1.

histf(...,'FaceColor',FaceColor) specifies face color as a short name, long name, or RGB triple.

histf(...,'EdgeColor',EdgeColor) specifies edge coloras a short name, long name, or RGB triple.

histf(...,'LineStyle',LineStyle) specifies line style of bar edges. Can be '-' (default), ':', '--', '-.', or 'none'.

histf(...,'LineWidth',LineWidth) specifies line width of bar edge in points. Default LineWidth is 0.5 points.

histf(...,'FaceAlpha',FaceAlpha) specifies transparency value of bar faces. FaceAlpha must be a scalar between 0 and 1. Default value is 1.

histf(...,'EdgeAlpha',EdgeAlpha) specifies transparency value of bar edges. EdgeAlpha must be a scalar between 0 and 1. Default value is 1.

histf(...,'Alpha',Alpha) sets FaceAlpha and EdgeAlpha to Alpha.

[n,xout,h] = histf(...) returns vectors n and xout containing the frequency counts and the bin locations. h is the handle of the newly plotted histogram.

Cite As

Chad Greene (2024). histf (https://www.mathworks.com/matlabcentral/fileexchange/47552-histf), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Distribution Plots in Help Center and MATLAB Answers
Acknowledgements

Inspired by: legalpha

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

histf_documentation/html/

Version Published Release Notes
1.0.0.0