Info

この質問は閉じられています。 編集または回答するには再度開いてください。

1-d array plotted with imagesc shown as 2-d

1 回表示 (過去 30 日間)
Antonios Nasioulas
Antonios Nasioulas 2020 年 6 月 27 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello,
I want to print an 1-d array lets say 1:10 with imagesc and I want the resulting plot to be an 1-d array as well.
But when for example I run
imagesc(1:10)
I get the following plot:
I would actually want the columns (the y-axis) to collapse in one square, namely:
I used for the latter graph
set(gca,'dataAspectRatio',[1 1 1])
but this also makes the colorbar small.
How can I do that have the latter figure, but with a bigger (in height) colorbar.
Thank you in advance
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 6 月 27 日
編集済み: KALYAN ACHARJYA 2020 年 6 月 27 日
Plot is 2 dimentional or more. What does 1 D plot mean? Can you share some pictorial image. try with bar? In imagesc, also no variation on y axis, only in x axis, right?
Antonios Nasioulas
Antonios Nasioulas 2020 年 6 月 27 日
Hello,
By 1D I mean that one of the dimensions is equal to 1. I updated my initial question to show what exactly I want to achieve. Is it clear now?
Thanks for the response

回答 (1 件)

Aditya Verma
Aditya Verma 2020 年 6 月 27 日
編集済み: Aditya Verma 2020 年 6 月 27 日
You can change the size of the current figure (gcf) using the position propery:
imagesc(1:10);
set(gcf,'position',[0, 0, 500, 50]);
yticks([0 1]);
  1 件のコメント
Antonios Nasioulas
Antonios Nasioulas 2020 年 6 月 27 日
編集済み: Antonios Nasioulas 2020 年 6 月 27 日
Hello,
This indeed gives the figure as I want it, but it also makes the colorbar small (see my inital question, I put another picture there). Can I somehow get a big in height colorbar and simultaneously have the 1x10 figure I want?

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by