XTickLabel在小节上具有可变的间隔 [英] XTickLabel with variable intervals at barplot

查看:95
本文介绍了XTickLabel在小节上具有可变的间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个条形图,其中条形位于以下x坐标:

I have a barplot where the bars are located at the following x-coordinates:

1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,30,35,40,45,50,55,60,70,80,90

我想在XTickLabel处显示这些值,但是当我使用

I want to show these values at the XTickLabel, however when I use

figure(1);

Vector = [1 2 3 4 5 6 7 8 9 10 12 14 16 18 20 22 24 26 28 30 35 40 45 50 60 70 80 90]
bar(Vector,Vector);
xticklabels(Vector);

我得到以下输出,但是我希望我的XTickLabel在相应的值下看起来像Vector:

I get the following output, but I want that my XTickLabel to look like Vector at the corresponding values:

如您所见,XTickLabel仅升至12,而某些条形未标记.

As you can see the XTickLabel only goes to 12 and some bars are not labeled.

我尝试使用

set(gca,'Xtick',1:1:Vector(length(Vector)))

但这对Xtick使用了线性间隔.

But this uses a linear interval for the Xtick.

推荐答案

您不需要xticklabel,除非您希望在刻度上标记与位置值不同的文本.

You don't need xticklabel, unless you want ticks label texts that are different from the values at their positions.

这篇关于XTickLabel在小节上具有可变的间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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