How to set the same grid size of the axis for different plots?
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sateesh Kandukuri
il 30 Gen 2023
Modificato: Walter Roberson
il 2 Feb 2023
Using imagesc function, I plotted the data for different sets of vaues. For the first plot, the x-axis limits are [-40 12] and for the second plot, the x-axis limits are [-56 8]. But I got the same size of the the plots. How to get the different size of the plots using an equal grid size for both the plots?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1278080/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1278085/image.jpeg)
If I add the colorbar the size of the second image plot shrinks. How to add the colorbar without affecting the size of the image?
2 Commenti
Risposta accettata
Walter Roberson
il 30 Gen 2023
Modificato: Walter Roberson
il 2 Feb 2023
You can set the plot box aspect ratio and data aspect ratio, or use the convenience of "axis image" https://www.mathworks.com/help/matlab/ref/axis.html#d124e70500
image objects fill at least one dimension of the axes, so if you need the drawing area to have the same pixel size for multiple axes, then you might need to set the axes Units to pixels and set the Position to the desired image size in pixels (make sure that you "axis off")
You can set the colorbar Position in pixels
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Performance in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!