EDA365电子论坛网
标题:
axes里面的图像在figure中显示,,为什么没有colorbar啊?
[打印本页]
作者:
whatever_
时间:
2022-9-30 13:59
标题:
axes里面的图像在figure中显示,,为什么没有colorbar啊?
我想直接保存axes里面的图形,可是没法保存。
, s7 a6 P1 D1 b
于是我用copyobj将axes里面的图形复制到figure里面,再进行保存,可是axes里面的colorbar没有传到figure里面,这得怎么办啊?
4 f9 e, C0 M4 P5 v( G1 o
代码如下:
/ z' o% G+ K L$ U0 g
new_f_handle=figure('visible','off');
( C! h/ t7 [+ @: j* [4 p2 m
new_axes=copyobj(handles.axes1,new_f_handle); %axes1是GUI界面绘图的坐标系
% d6 r! {/ z4 X* v4 c5 c* D
set(new_axes,'units','default','position','default');
4 z5 \/ h, g9 f+ k1 X5 B( V
[filename,pathname fileindex]=uiputfile({'*.jpg';'*.bmp'},'save picture as');
( J. W9 J: T7 m* s7 A2 {) T
if ~filename
0 r8 H0 A8 @; {2 X4 @) J+ x
return
' V3 D0 e$ ^ k. a5 \7 i9 K! n
else
6 A/ s: q, |) W* a
file=strcat(pathname,filename);
8 I8 F/ x. d8 L% i
switch fileindex %根据不同的选择保存为不同的类型
. q0 C4 I$ h- P
case 1
0 D: b# c1 S0 v+ ~5 {4 m! t+ `
print(new_f_handle,'-djpeg',file);
$ e/ b4 C! W# d6 | j# p
case 2
" u3 v' @3 F" a7 h9 I/ @4 M& n
print(new_f_handle,'-dbmp',file);
, f$ [5 W2 w. U: z" N
end
( M( \. ` G. c) ?& I, v
end
4 h4 F) ?2 `( E; t1 @' V
delete(new_f_handle);
' V' [+ i6 j q+ `* V
) f0 p* G% \9 L9 U
+ K6 k0 c' b) w! b
如此保存之后,还是没有colorbar
( R# C( V9 \7 B8 ]8 }
作者:
unfaithful2021
时间:
2022-9-30 14:59
执行 colorbar然后figure中就有了
作者:
whatever_
时间:
2022-9-30 15:15
可是我有多幅图像要在figure中显示并保存,有的是不带colorbar的 ,这样就默认了所有传到figure里面的图形都带colorbar了
作者:
unfaithful2021
时间:
2022-9-30 15:21
改为可见new_f_handle=figure('visible','on');看有没有复制过来。如果有的话可能是print的问题,试试imwrite
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2