![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175919/image.png)
plotting in 2d with imagesc
20 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Naema
el 7 de Abr. de 2015
Comentada: Ar
el 29 de Mzo. de 2023
Hi : I have a question about the plot command (imagesc). I am overlapping two fields together and when plotted both of them using (imagesc), I noted that they are flipped vertically. This caused me to have doubt about if the result of the overlap, which I also plotted using (imagesc), is also flipped or not. Please, help me with useful information. thanks
0 comentarios
Respuesta aceptada
Chad Greene
el 7 de Abr. de 2015
You can specify the x and y coordinates of each pixel with imagesc, and use axis xy to ensure the y direction is positive up:
% some fake data
x = (100:200)';
y = (0:.1:20)+ 30;
z = sind(x*y)+x*y/1000;
% plot:
pcolor(z)
figure
imagesc(x,y,z)
axis xy
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175919/image.png)
3 comentarios
DGM
el 28 de Mzo. de 2023
The default colormap changed from jet() to parula shortly before this answer was written. It's possible that it simply reflects the default behavior of the software he had installed. It could also have simply been a stale figure property from some prior code. Either way, the colormap in use is not parula(), but jet().
The difference with pcolor() is simply that the edge lines are black, and there are lots of them. You can hide them simply.
% some fake data
x = (100:200)';
y = (0:.1:20)+ 30;
z = sind(x*y)+x*y/1000;
% plot:
pcolor(z)
shading flat
colorbar
colormap(jet(256))
figure
imagesc(x,y,z)
axis xy
colorbar
colormap(jet(256))
Más respuestas (1)
Image Analyst
el 8 de Abr. de 2015
You can specify whether the lower values of Y are at the top, like for images and matrices, or at the bottom, like for traditional x,y plots:
set(gca, 'YDir', 'reverse'); % or 'normal'
0 comentarios
Ver también
Categorías
Más información sobre Blue en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!