matlab bar坐标轴,matlab bar图x轴坐标旋转函数

本文介绍如何在MATLAB中创建bar图并旋转x轴坐标标签,提供了一个名为`rotateticklabel`的函数示例,该函数用于将坐标轴标签旋转指定角度,防止长字符串被截断。
摘要由CSDN通过智能技术生成

网上查到的,转载下,已测试可以使用

示例:

x = round(rand(5,3)*10);

h=bar(x,1,'group');

set(gca,'xticklabels',{'benchmark1','benchmark2','benchmark3','benchmark4','benchmark5'});

h = gca;

th=rotateticklabel(h, 45);%调用下面的函数,坐标倾斜45度

代码如下:

function th=rotateticklabel(h,rot,demo)

%ROTATETICKLABEL rotates tick labels

% TH=ROTATETICKLABEL(H,ROT) ris the calling form where H is a handle to

% the axis that contains the XTickLabels that are to be rotated. ROT is

% an optional parameter that specifies the angle of rotation. The default

% angle is 90. TH is a handle to the text objects created. For long

% strings such as those produced by datetick, you may have to adjust the

% position of the axes so the labels don't get cut off.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值