How can I change the values of the axis to use values from a vector instead of matrix position
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Pedro Alejandro Garza Juarez
el 8 de Abr. de 2017
Comentada: Star Strider
el 8 de Abr. de 2017
I have a plot in imagesc where I want it to use the values of the original vector instead of the position value of the matrix, i.e. the range of the vector I used originally is 200 (-10:0.1:10) and I want to use those instead of the position 1:200. From this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162740/image.png)
to this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162741/image.png)
0 comentarios
Respuesta aceptada
Star Strider
el 8 de Abr. de 2017
Use the get and set functions to get the ticks, then relabel them:
xt = get(gca, 'XTick');
yt = get(gca, 'YTick');
xtix = linspace(-10, 10, length(xt));
ytix = linspace(-10, 10, length(yt));
set(gca, 'XTick',xt,'XTickLabel',xtix, 'YTick',yt,'YTickLabel',ytix)
This will get you started. Make necessary changes to get the result you want.
(Instead of using gca, it is better to use the actual axis handle, but this will work.)
Also, for your purposes, use:
axis equal
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots 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!