How to overlay a log-plot on top of an image

조회 수: 3 (최근 30일)
Knut
Knut 2013년 3월 26일
댓글: Scott Webster 2015년 2월 19일
Here is the use-case: You have access to an image of a MATLAB semilogx() plot from a paper, a website or something similar. The original data are not easily available. You want to manually approximate the original vector. If one could overlay a local MATLAB semilogx() plot on top of the figure, that would make the tedious job slightly less tedious.
  댓글 수: 1
Scott Webster
Scott Webster 2015년 2월 19일
If I'm understanding what you are trying to do correctly, you might want to considering using alternative tools to get at the data, several of which exist, e.g.

댓글을 달려면 로그인하십시오.

채택된 답변

Knut
Knut 2013년 3월 26일
편집: Knut 2013년 3월 26일
Here is my suggested solution. Nothing ground-breaking, but a bit fiddly for my skills using axes.
%%generate some trivial data
[b1,a1] = butter(2,1200./48e3);
[b2,a2] = butter(2,1200./48e3,'high');
H1 = freqz(b1,a1,512,48e3);
H2 = freqz(b2,a2,512,48e3);
im = imread('ngc6543a.jpg');
%%do the actual plotting
figure
%define plot extent so that image can be aligned with plot
xrng = [20 30e3]./1000;
yrng = [-60 10];
image(xrng,yrng,im);
ax1 = gca;
%get rid of pixel ticklabels
set(ax1,'YTickLabel', [], 'XTickLabel', [])
%color=none to make the image visible
ax2 = axes('Position',get(ax1,'Position'),'Color','none','XScale', 'log');
ylim(yrng)
xlim(xrng)
xlabel('Frequency - kHz')
ylabel('power - dB')
title('Frequency response')
line(W, 20*log10(abs([H1 H2])),'Parent',ax2);
legend('lopass', 'hipass')
Inspired by:
  댓글 수: 2
Stanley Kubrick
Stanley Kubrick 2015년 2월 19일
I've actually just resorted to taking screenshots and overlaying it manually like this:
Star Strider
Star Strider 2015년 2월 19일
@Stanley Kubrick — You should probably post that also as a Comment to your post Semilog plot with background image.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by