필터 지우기
필터 지우기

superimposing plots.

조회 수: 4 (최근 30일)
God'sSon
God'sSon 2011년 5월 25일
[EDIT: Wed May 25 22:22:46 UTC 2011 - Reformat - MKF]
Hello, I have the two following plots which I am trying to superimpose. I want figure two to be super imposed on figure 1 but figure 1 has a log scale on its x axis. Can someone please help.
semilogx(f,x) %figure 1
stem(y,z) %figure 2

채택된 답변

Matt Fig
Matt Fig 2011년 5월 25일
Why not use SUBPLOT?
subplot(1,2,1)
stem(y,z)
supbplot(1,2,2)
semilogx(f,x)
By the way, a figure is the window that holds the axes object. If you want them on the same axes, do
semilogx(f,x)
hold on
stem(y,z)
  댓글 수: 2
God'sSon
God'sSon 2011년 5월 25일
thank you for your answer, I have used the second option. but how can i rescale the axis of stem(y,z) to become linear for the values of y instead of logarithmic
Matt Fig
Matt Fig 2011년 5월 25일
If that is your concern, do this:
x = 1:10:10000;
semilogx(x,.3*x.^3);
axx = gca;
ax = axes;
plot(x,x.^5,'r')
set(ax,'visible','off','ylim',get(axx,'ylim'))
The last line scales the ylimits of the second axes to match the first axes. If you don't want to do this, just take the part out where ylim is set.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 5월 25일
Perhaps the MATLAB File Exchange contribution plotxx would be of use to you.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by