필터 지우기
필터 지우기

how to specity axis using imagesc

조회 수: 143 (최근 30일)
Sudharsan Srinivasan
Sudharsan Srinivasan 2017년 10월 27일
편집: Real User 2024년 1월 23일
Hi. I have a matrix A of size 200*40. I have to generate image for every 200 time steps for which i am using imagesc(A). By default matlab takes the x and y axis as the size of the matrix. But I want to force both the axis between 0 and 1. Any suggestions ?

채택된 답변

Honglei Chen
Honglei Chen 2017년 10월 27일
You can just do
imagesc(linspace(0,1,40),linspace(0,1,200),A)
HTH
  댓글 수: 1
Real User
Real User 2024년 1월 19일
편집: Real User 2024년 1월 23일
Thank you. Indeed: imagesc plots the matrix "in the matrix order".
That is, y-axis top-to-bottom = rows of A from 1 to 200, and x-axis left-to-right = columns of A from 1 to 40.
In particular, A(1) = top left, A(200) = bottom left, etc. Axis values have first x, then y (i.e., first "column values", then "row values"). Therefore, indeed, linspace(0,1,40) must be first, although it is a 200x40 matrix.
imagesc(xAxisValues,yAxisValues,reshape(B,nY,nX))
when B is to have nY rows (y-axis top-to-bottom in imagesc) and nX columns (x-axis). Otherwise, it is hard to remember that we have xAxisValues before yAxisValues but nY before nX.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by