Radial histogram for categorical data
Version 1.1.0 (170 KB) von
Austin M. Weber
Make radial histograms (a.k.a. polar histogram or circular histogram) for visualizing categorical data
Documentation
Radial histogram for categorical data
SYNTAX
radialhistogram(categorical_data)
radialhistogram(categorical_data,Name=Value)
h = radialhistogram(___)
[~,parent] = radialhistogram(__)
__________________________________________________________________________
DESCRIPTION
radialhistogram(categorical_data) creates a histogram plot in polar coordinates by visualizing each category in the categorical vector categorical_data.
radialhistogram(categorical_data,Name=Value) specifies additional options using one or more name-value pair arguments. For example, you can sort the data in ascending order by specifying DisplayOrder='ascend'. You can also normalize the data as percentages by specifying Normalization='percentage', or you can add values to the categorical labels by specifying DisplayValues=true. A full list of name-value pair arguments is given below.
h = radialhistogram(___) returns the Histogram object. Use h to modify the histogram after it is created.
[~,parent] = radialhistogram(__) returns the parent object. Use parent to modify the parent axes after it is created.
__________________________________________________________________________
NAME-VALUE PAIRS
The following name-value pairs adjust the histogram (h) properties:
NAME VALUE (default) OTHER
DisplayOrder 'none' 'ascend' | 'descend'
DisplayStyle 'bar' 'stairs'
DisplayValues true false
EdgeAlpha 1 0 < EdgeAlpha ≤ 1
EdgeColor [0 0 0] RGB triplet or hexadecimal
FaceAlpha 0.6 0 < FaceAlpha ≤ 1
FaceColor [0.000 0.4470 0.7410] RGB triplet or hexadecimal
HandleVisibility 'on' 'off'
LineStyle '-' '--' | '-.' | ':' | 'none'
LineWidth 0.5 0 < LineWidth
Normalization 'count' 'cdf' | 'cumcounts' | 'pdf' |
'probability' | 'percentage'
Visible 'on' 'off'
The following name-value pairs adjust the h.Parent properties:
NAME VALUE (default) OTHER
BackgroundColor [1 1 1] RGB triplet or hexadecimal
FontAngle 'normal' 'italic'
FontName 'Helvetica' example: 'Times'
FontSize 10 0 < FontSize
FontWeight 'normal' 'bold'
GridAlpha 0.15 0 < GridAlpha ≤ 1
GridColor [0.15 0.15 0.15] RGB Triplet or hexadecimal
GridLineStyle '-' '--' | '-.' | ':' | 'none'
MinorGridAlpha 0.25 0 < MinorGridAlpha ≤ 1
MinorGridColor [0.1 0.1 0.1] RGB triplet or hexadecimal
MinorGridLineStyle':' '--' | '-.' | '-' | 'none'
RAxisLocation 80 0 ≤ RAxisLocation ≤ 360
RColor [0.15 0.15 0.15] RGB Triplet or hexadecimal
RDir 'normal' 'reverse'
ThetaColor [0.15 0.15 0.15] RGB Triplet or hexadecimal
ThetaDir 'counterclockwise' 'clockwise'
ThetaZeroLocation 'right' 'top' | 'bottom' | 'left'
Tip: When using the parent output argument the background color property is parent.Color (NOT parent.BackgroundColor).
__________________________________________________________________________
EXAMPLES
Basic radialhistogram
load authors.mat
figure(1)
radialhistogram(authors);
Add customizations to radialhistogram
figure(2)
h = radialhistogram(authors,...
Normalization='percentage',...
DisplayOrder='descend',...
DisplayValues=true,...
FaceColor=[0.8500 0.3250 0.0980],...
LineWidth=1);
See demo.mlx for more examples.
Zitieren als
Austin M. Weber (2024). Radial histogram for categorical data (https://www.mathworks.com/matlabcentral/fileexchange/157796-radial-histogram-for-categorical-data), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2023b
Kompatibel mit R2016a und späteren Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.1.0 | Added 26 new customization options and an optional output handle to adjust the parent axes. |
||
1.0.0 |