如何在同一个无花果Matlab中制作两个条形图 [英] how to make two bars in the same fig Matlab

查看:163
本文介绍了如何在同一个无花果Matlab中制作两个条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在matlab的同一无花果中制作两个条形图.现在,我有两个单独的条形图,我想要做的是将它们组合成一个图表,但是具有不同的颜色(例如红色和蓝色)以区分两个条形图. 这是出现的两个条形图:

I want to make two bars in the same fig in matlab. Now, I have two separate bar charts, what I want to do is combining them in one chart but with different colors (eg red and blue) to differentiate between the two barcharts. This is the two barcharts appearing:

我想做的是这样的:

what I want to do is something like this:

下面是我正在使用的代码,因此如果有人可以请帮助我.

Below is the code I'm using so if anyone could please help me.

load('x640_Sensor_Lights_On_1000mm-pgms.mat');
uu=unique(n);
nn=histc(n, uu);
h=figure; bar(uu,nn/numel(n));
print(h, '-dpdf', 'x1000');
saveas(h,'x1000','fig');

load('k640_Sensor_Lights_On_1000mm-pgms.mat');
uu=unique(n);
nn=histc(n, uu);
h=figure; bar(uu,nn/numel(n));
print(h, '-dpdf', 'k1000');
saveas(h,'k1000','fig');

推荐答案

您可以查看bar()中的示例,尤其是有关

You can check out the examples in bar() and specifically about bar styles:

这篇关于如何在同一个无花果Matlab中制作两个条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆