划分图形并处理Xticks(Matlab)

编程入门 行业动态 更新时间:2024-10-24 06:35:45
本文介绍了划分图形并处理Xticks(Matlab)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Matlab中遇到一些数字问题.我将条形图分为两个数字,因为我总共有171条.我首先获取了数据的上半部分(图1),然后获取了下半部分(图2).但是后来我有了Xticks的问题.现在两者都从零开始,但是我想让后半部分(图2)从86到171(或者以10为间隔,例如,从80到180).我尝试将set(gca,'XLim',[86 171]设置为第二个图形,但是发生的是那个图形中的条形图最终超出了该图形,这是我之前从未想过的...任何提示如何解决Xticks/划分数字有问题吗?

I have some problems with figures in Matlab. I divided my bar plot into two figures since I have totally 171 bars. I took the first half of the data at first (figure 1) and then the second half (figure 2). But then I got a problem with Xticks. Now both start from zero, but I would want the second half (figure 2) to be from 86 to 171 (or with intervals of 10 so that they are from 80 to 180, for instance). I tried set(gca, ‘XLim’, [86 171] to the second figure, but what happened was that bars in that figure ended up outside the figure, which I hadn’t thought before... Any hints how to solve the problem with the Xticks/dividing the figure?

我还有关于Xticks的另一个问题!我想将它们在图中向下移动,因为我在每个小节的正上方添加了文本(或实际上是对应于不同小节的其他数字).我通过"set(gcf,'Position',get(0,'Screensize'));使数字适合整个屏幕,但是Xticks应该向下移动,以使Xticks和其他数字不在每个顶部其他.我想学习如何解决这些问题,但是似乎我需要经验丰富的人的帮助!

I also have another question about Xticks! I would want to move them downwards in the figure, since I have added text (or actually other numbers which correspond to different bars) right above every bar. I made the figures to fit the whole screen by "set(gcf, 'Position', get(0,'Screensize'));", but Xticks should be moved downwards so that Xticks and and other numbers are not on top of each other. I would like to learn how to solve these problems, but it seems like I need help from someone who has more experience!

推荐答案

x刻度是由bar()的X参数指定的.

The x ticks are specified by the X argument to bar().

n = 171; x = randi(20, n); subplot(2,1,1) bar(1:85, x(1:85)) subplot(2,1,2) bar(86:171, x(86:171))

更多推荐

划分图形并处理Xticks(Matlab)

本文发布于:2023-11-30 05:29:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648880.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图形   Xticks   Matlab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!