2016-09-12 7 views
1

에서 분석 사진을 플롯하는 방법 :내가 MATLAB에서이 같은 음모 만들고 싶어 어떻게 MATLAB

enter image description here

내가 구글에서 검색하지만 MATLAB에서 할 수있는 방법을 찾지 못했습니다입니다.
어떻게 그 수치를 MATLAB에서 할 수 있습니까? 정확히 같은 줄거리 일 필요는 없지만 동일한 정보가 줄거리에 포함되어야합니다. 감사합니다.

+0

당신이 어떤 종류의 데이터가 나는 변경 사항을 주석? – EBH

+0

그것은 더 많은 다이어그램이 아닌 진정한 음모로 보입니다. 그래서 저는 matlab이 그것을위한 완벽한 도구라고 생각하지 않습니다. – obchardon

+1

위의 줄거리와 같은 정보 ... 당신의 제안은 무엇입니까? 적합한 도구는 무엇입니까? – Joe

답변

2

그것은 그래서 여기에 댓글 너무 긴 @ nilZ0r의 고정 된 (그리고 루프없이) 버전 대답은 (당신이 어떤 대답을 받아들이려고하는 경우에, 동의 그의).

% Create figure and axes 
f = figure('Color',[1 1 1]); clf % <-- white background 
a = axes; 
aPos = [0.1 0.1 0.03 0.8]; 
gbColor = [0 1 0.7]; 
yTick = logspace(4,10,7); 
YTickLlb = {'0.01MHz','0.1 MHz','1.0 MHz','10 MHz','100 MHz','1 GHz',''}; 
set(a,... 
    'Position', aPos, ... 
    'YAxisLocation','right', ... 
    'YLim', yTick([1 end]), ... 
    'YScale','log',... 
    'YTickLabel',YTickLlb,... 
    'XTick',[], ... 
    'Box','on',... 
    'Color', gbColor) 
title('Frequency') 

% Plot text 
txtFontSize = 12; 
txt = {'Hearing threshold (20 kHz)','Therapeutic applications',... 
    'Medical imaging','Ultrasound microscopy'}; 
txtPos = [2e4 1e6 2e7 1e9]; 
txtOffset = 5; 
% No need for a loop: 
text(ones(numel(txtPos),1)*txtOffset, txtPos, txt,'FontSize', txtFontSize); 

% Plot arrows (with figure as reference) 
arrowPos = [[6 70]*1e6; [7 70]*1e8]; % <-- matrix instead of a cell array 
% arrowType is deleted 
arrowOffset = (aPos(1) + aPos(3)*txtOffset*0.9)*[1 1]; 
normYTick = linspace(0,1,length(yTick)); 
% two different calls to 'annotation', based on the arrow type: 
annotation(f, 'doublearrow', arrowOffset, interp1(yTick, normYTick,... 
    arrowPos(1,:))*aPos(4) + aPos(2),'HeadStyle','Plain','Head1Width',4,... 
    'Head2Width',4, 'Head1Length', 4,'Head2Length', 4); 
annotation(f, 'arrow', arrowOffset, interp1(yTick, normYTick,... 
    arrowPos(2,:))*aPos(4) + aPos(2),'HeadStyle','Plain','HeadWidth',4,... 
    'HeadLength',4); 

% Plot information text 
text(7, yTick(end), '\lambda f = 1500 ms^{-1} in water',... 
    'FontSize', txtFontSize) 

그리고 결과 :

Frequency

3

의견에서 언급했듯이, 다른 프로그램에서는이 방법을 사용하는 것이 더 쉽습니다. 하지만 을 Matlab에서해야 할 경우, 이와 같이해야합니다.

% Create figure and axes 
f = figure(1); clf 
a = axes; 
aPos = [0.1 0.1 0.03 0.8]; 
gbColor = [0 1 0.7]; 
yTick = logspace(4,10,7); 
YTickLlb = {'0.01Mz','0.1 MHz','1.0 MHz','10 MHz','100 MHz','1 GHz',''}; 
set(a,... 
    'Position', aPos, ... 
    'YAxisLocation','right', ... 
    'YLim', yTick([1 end]), ... 
    'YScale','log',... 
    'YTickLabel',YTickLlb,... 
    'XTick',[], ... 
    'Box','on',... 
    'Color', gbColor) 
title('Frequency') 

% Plot text 
txtFontSize = 12; 
txt = {'Hearing threshold (20 kHz)','Therapeutic applications','Medical imaging','Ultrasound microscopy'}; 
txtPos = [2e4 1e6 2e7 1e9]; 
txtOffset = 5; 
for k = 1:length(txt) 
    t(k) = text(txtOffset, txtPos(k), txt{k},'FontSize', txtFontSize); 
end 

% Plot arrows (with figure as reference) 
arrowPos = {[6 70]*1e6, [7 70]*1e8}; 
arrowType = {'doublearrow', 'arrow'}; 
arrowOffset = (aPos(1) + aPos(3)*txtOffset*0.9)*[1 1]; 
normYTick = linspace(0,1,length(yTick)); 
for k = 1:length(arrowPos) 
    annotation(f, arrowType{k}, arrowOffset, interp1(yTick, normYTick, arrowPos{k})*aPos(4) + aPos(2),... 
     'HeadStyle','Plain','HeadWidth',4, 'HeadLength', 4); 
end 

% Plot information text 
text(7, yTick(end), '\lambda f = 1500 ms^{-1} in water','FontSize', txtFontSize) 
+1

이것은 "DoubleEndArrow 클래스에 HeadWidth 속성이 없습니다"_, 'Head1Width'와'Head2Width'가 있으며'HeadLength '. 그러나'arrowType {k} '이 다른 유형의 화살표와 섞여 있기 때문에 단순히이 속성을 변경하면'Arrow' 클래스에서 오류가 발생합니다. – EBH

+0

@EBH 적어도 초기 Matlab 버전에서는 이중 화살표 주석 항목의 경우 적절한 HeadWidth (또는 HeadLength)가 Head1Width 및 Head2With로 재 해석됩니다. 예를 들어'set (h, 'HeadWidth', 6)'을 설정함으로써'Head1Width'와'Head2Width' 둘 다 바뀔 것입니다. 그러나 최신 Matlab 버전으로 업데이트하지 않았으므로 아마 변경되었을 것입니다. – NLindros

+0

글쎄, [docs] (http://www.mathworks.com/help/matlab/ref/annotationdoublearrow-properties.html#property_head1length)에 언급 된 것과 같은 것이 없습니다. BTW 나는 R2015a를 사용합니다. 어쨌든 나는 노력을 위해 upvote : – EBH

관련 문제