Hello everyone,
i want to use imagesc() with 2 depending x axes. For example ax1 is the time and ax2 is the travelt distance (constante velocity). So There is just a function like distance=time*velocity witch change the number of the axes. At the moment i try something like this:
X=1:10;
Y=1:10;
Z=randn(10,10);
Velocity=33;
imagesc(X,Y,Z);
ax1=gca;
xlabel('Time');
ylabel('Wavelength');
ax2 = axes('Position',ax1.Position,'Color','none');
ax2.XAxis.TickLabelFormat=('%.2f');
ax2.XAxisLocation = 'top';
ax2.XTick= ax1.XTick;
ax2.YLim=[min(Y),max(Y)];
ax2.YTick = [];
ax2.XTickLabel=(X*Velocity);
xlabel('Distance');
linkaxes([ax1,ax2],'xy')
But if i want to change the colorbar the Plot get ugly. The Position of the box arn't correct anymore (i get a littel offset off ax1 and ax2). Another drawback ist, that the ax2 is fix, so if i want to look a a closer region the ax2 may disappear to missing ticks.
At the moment look like to layer, because i can have two different colorbars. One representing my Data and an emty one from 0 to 1 values.
To set the Colorbar automatical is not an option, i need to by flexible.
Hope there is an soulution. I may use a different function than imagesc, but i want to present it as a 2D false Image plot.
Thanks you in advance. Im still useing Matlab2016b
PS:edit minimal exampel for being fully functional