简介
本文介绍如何使用matlab定制自己的直方图。
关键
- 使用Matlab的
bar()
函数创建柱状图 bar()
画的bin的高度跟数据相关bar()
数据每一列一个group,有几列数据就画出几组柱状图- 坐标轴显示的刻度叫 XTick 或 YTick
- 注意gca和gcf的区别,可以doc他们分别查看相关说明
示例代码
close all;
clc
clear;
% bins data
num_bins = 5;
num_methods = 3;
data = rand(num_bins, num_methods);
% draw the graph
figure;
handle_bar = bar(data);
ax = gca;
% tight the graph
axis tight;
% title and labels
title('\bf\color[rgb]{0,0,0}histgram');
xlabel('