The image changes color and position
3 views (last 30 days)
I`m trying to plot a data represents by points and display an image in the background of the graphics. But it change the color and the position of the image (the image is white, matlab is change for yellow).
I tried [X,cmap], but I also need adapt the size of the image to chart scale.
velocidade_gas = [1.40 1.3896 1.3879 1.3843];
velocidade_liquido = [2.427 3.230 4.180 4.919];
loglog(velocidade_gas,velocidade_liquido,'s','MarkerFaceColor',[0 0.447 0.741]);
xlabel('Velocidade Supeficial do Gás (m/s)');
ylabel('Velocidade Superficial do Líquido (m/s)');
title('Pontos Gerados no Mapa de Mandhane');
axis([0.1 500 0.01 20]);
[X, cmap] = imread('mandhane.jpeg');
image(xlim, ylim, [X, cmap]);
mapa = uistack(X,'bottom');
DGM on 27 Apr 2022
Edited: DGM on 27 Apr 2022
I'm not sure why the image is upside-down, but the reason it's yellow is probably because it's a monochrome (single-channel) image. When you give image() a single-channel image, it applies the current colormap to it (probably parula() in this case).
If so, the fix is simple.
X = imread('mandhane.jpeg');
image(xlim, ylim,repmat(X,[1 1 3]));
This simply replicates the single-channel image into a 3-channel image -- which image() will treat as an RGB image instead of colormapping it.
That's just my current estimation. It'd help to see the actual image to be sure what's going on.
If you're doing a bunch of fancy stuff with your axes setup that's causing the image to be shown upside-down, you can always just flip it before displaying
X = flipud(X);