image - 在 MATLAB 中将两个 y 轴放在 imagesc 图像上

标签 image matlab image-processing plot axes

我有一个我认为很简单的问题:我有一个使用 imagesc 成像的矩阵。我只想在图像的右侧显示第二个 y 轴。我怎么做?示例:

clear all;
aMatrix = rand(20,30);
yAxis1 = 32.*(1:size(aMatrix,1));
yAxis2 = 165.*(1:size(aMatrix,1));
xAxis = 1:size(aMatrix,2);
imagesc(yAxis1, xAxis1, aMatrix);

以下将在左侧显示带有 yAxis1 的图像。这很好,但是如何同时在图像的右侧显示 yAxis2?谢谢。

最佳答案

  aMatrix = rand(20,30);
  yAxis1 = 32.*(1:size(aMatrix,1));
  yAxis2 = 165.*(1:size(aMatrix,1));
  xAxis = 1:size(aMatrix,2);
  h1=imagesc(xAxis, yAxis1, aMatrix);set(gca,'YDir','normal');
  ax1=gca;
  set(ax1,'YColor','r','YAxisLocation','right');
  set(ax1,'XTickLabel',' ');
  ax2=axes('Position',get(ax1,'Position'),'YAxisLocation','left');
  h2=imagesc(xAxis, yAxis2,aMatrix,'Parent',ax2);
  set(gca,'YDir','normal');

enter image description here

关于image - 在 MATLAB 中将两个 y 轴放在 imagesc 图像上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21005088/

相关文章:

javascript - blurDataURL 的 Nextjs 数据 URL

java - MATLAB : access uigetdir's internal java methods

image - 寻找噪声图像边缘的最佳方法

OpenCV:移动单相机的旋转矩阵和平移向量

image - stackoverflow 深色主题并显示用户 Logo

python - 如何修复对象图像无法正确加载的问题

Python/PIL仿射变换

python - 像 MATLAB 匿名函数一样在 python 中使用 lambda 函数

ios - 如何修复此 YCrCb -> RBG 转换公式?

html - 帮助边框图像上的CSS