Re: [討論] subplot 取 errorbar 的data
※ 引述《laion (回地球啦)》之銘言:
: 我剛測試過假如只有一張圖
: h=figure
: errorbar(x,y,err,'bo-')
: 取誤差的data的寫法可用一般取data的方法
: 即
: get_err=get(get(gca,'children'),'UData')
: 或把UData 改成LData也行
: ******
: 但同樣的方法在subplot下面卻不行
: 例如原圖為
: h1=subplot(1,2,1);
: errorbar(x,y,err,'bo-');
: h2=subplot(1,2,2);
: errorbar(x,y,err,'bo-');
: 假如我要取第一張圖的誤差
: s=get(gca,'children');
不建議這樣做,
你怎麼知道gca是指第一張還是第二張圖,
而且這樣做是脫褲子放屁,
h1即為第一張圖的axes handle,h2是第二張圖的,
s = get(h1, 'children');
: get_err=get(get(s(1),'children'),'Udata')
: 確沒有辦法得到數據 (似乎children下沒有udata的物件,用xdata/ydata都可以取到數據)
: 有人知道原因嗎??
: 謝謝!!
因為你的s即為errorbar的handle,
get(s,'children')是所有點以及誤差線(工)的handle,
所以可以讀取xdata/ydata但不能讀取udata
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.67.49.24
推
03/21 09:26, , 1F
03/21 09:26, 1F
→
03/21 09:26, , 2F
03/21 09:26, 2F
→
03/21 09:27, , 3F
03/21 09:27, 3F
→
03/21 15:08, , 4F
03/21 15:08, 4F
→
03/21 15:08, , 5F
03/21 15:08, 5F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):