19-2 �v������ܻP�C�L

MATLAB ¦bÅã¥Ü¼v¹³®É¡A·|±N¤§¸m©ó¹w³]ªº¹Ï¶b¤§¤¤¡A¨Ã¥H¦¹¹Ï¶bªºªø¼e¤ñ¨Ó¦¨¹³¡A¦]¦Ó³y¦¨¼v¹³ªº¥¢¯u¡C­Y­n¥H¼v¹³¥»¨­ªºªø¼e¤ñ¨Ó¦¨¹³¡A¥i¥[¤J axis image¡A¦p¤U:

Example 1: 19-¼v¹³Åã¥Ü»PŪ¼g/image05.mload mandrill.mat image(X); colormap(map); colorbar; axis image

¦b¤W­z½d¨Ò¤¤¡A¦pªG¤£¨Ï¥Î¡uaxis image¡v¡A¨º»òµe¥X¨Óªº¹Ïªº¤j¤p´N¬O MATLAB ªº¹w³]¹Ï¶bªº¤j¤p¡A©Ò¥H·|±o¨ì¤@­Ó¤ñ¨Ò¤£¹ïªº¡u­DµU¤l¡v¡C¡]¦pªG¦¹®É§A¥h§ïÅܵøµ¡¤j¤p¡A´N¥i¥H¬Ý¨ì¹Ï§Îªº¤ñ¨Ò¤]·|¸òµÛ§ïÅÜ¡C¡^

­Y­n¨Ï¼v¹³¸ê®Æªº¨C¤@ÂI¹ïÀ³¦Ü¿Ã¹õ¤Wªº¤@­Ó¹³¯À¡]Pixel¡^¡A¥i¿é¤J¦p¤U:

Example 2: 19-¼v¹³Åã¥Ü»PŪ¼g/image06.mload mandrill.mat [m, n] = size(X); figure ('unit', 'pixel', 'position', [200, 200, n, m]); image(X); colormap(map); set(gca, 'position', [0, 0, 1, 1]);

¦¹½d¨Ò²£¥Í¹Ï§Î¦p¦P«e¤@­Ó½d¨Ò¡A¦ý¬O¼v¹³¸ê®Æªº¨C¤@ÂI¥i¥H¹ïÀ³¨ì¿Ã¹õ¤Wªº¤@­Ó¹³¯À¡A©Ò¥H¦pªG§Aªº¿Ã¹õ¸ÑªR«×¸û§C¡A¹Ï§Î·|Åܤj¡C¦b¤W­z½d¨Òµ{¦¡½X¤¤¡A figure ªº 'position' ©Ê½è¬° [200, 200, n, m]¡A¥Nªíµøµ¡ªº¥ª¤U¨¤¦ì¸m¬O [200, 200]¡]¥H pixel ¬°³æ¦ì¡^¡A¦Óµøµ¡ªº¼e«×¬° n¡A°ª«×¬° m¡A¥¿¦n¥i¥H²Å¦X¼v¹³ªº¤j¤p¡Cgca ¶Ç¦^¨Ï¥Î¤¤ªº¹Ï¶b¡A¤W¨Òªº³Ì«á¤@­Ó±Ô­z±N¹Ï¶bªº¦ì¸m³]¬°¾ã­Óµøµ¡ªº¤j¤p¡A¨Ï¥Î¤F¥¿³W¤Æªº³æ¦ì¡]Normalized Unit¡^¡C¡]¦³Ãö©ó gca ¤Î set «ü¥O¡A½Ð¸Ô¨£¥»®Ñ²Ä¤C³¹¡u´¤§â¦¡¹Ï§Î»P GUI ³]­p¡v¡C¡^

Hint
¦¹¸`¥Î¨ì¤F³\¦h´¤§â¦¡¹Ï§Î¡]Handle Graphics¡^ªº¥\¯à¡A­Y­nª¾¹D§ó¦hªº²Ó¸`¡A¥i°Ñ¦Ò¥»®Ñ²Ä¤C³¹¡u´¤§â¦¡¹Ï§Î»P GUI ³]­p¡v¡C

¦b¦C¦L¼v¹³®É¡AMATLAB ·|®Ú¾Úµøµ¡ªº Paper position ©Ê½è¨Ó½Õ¾ã¹Ï§Îªºªø¼e¤ñ¡A¨Ï±o¦L¥Xªº¼v¹³¦A«×ÅܧΡC±ý¨¾¤î±¡ªp¡A¥i¤U¹F¤@¦C«ü¥O¡G

>>set(gcf, 'PaperPositionMode', 'auto')

§Y¥i¦L¥X¥¿±`ªº¼v¹³¡C¨ä¤¤ gcf ¶Ç¦^¨Ï¥Î¤¤ªºµøµ¡¡A±N¡§Paper Position Mode¡¨³]¬°¡§auto¡¨¡A«h¦b¦C¦L®É¦C¦L¥Xªºªø¼e¤ñ·|©MÅã¥Ü¦b¿Ã¹õªºªø¼e¤ñ¤@¼Ë¡C

­Y­n¨Ï Paper Position Mode ªº¹w³]­È´N¬O¡§auto¡¨¡A¥i¦b startup.m Àɮפ¤¥[¤J¤U¤@¦æ:

>>set(0, 'DefaultFigurePaperPositionMode', 'auto')
MATLABµ{¦¡³]­p¡G¤Jªù½g