how can i use function of plots that i made inside subplot?

조회 수: 3 (최근 30일)
Kobi
Kobi 2015년 1월 5일
댓글: Star Strider 2015년 1월 5일
i made this function that create a polar plot how can i use this in subplot, i tried this but it didn't work, it makes a mess.

채택된 답변

Star Strider
Star Strider 2015년 1월 5일
You can do polar plots in subplots:
x = linspace(0, 2*pi);
y1 = sin(x).^2;
y2 = cos(x).^2;
figure(1)
subplot(2,1,1)
polar(x, y1)
axis equal
subplot(2,1,2)
polar(x, y2)
axis equal
The problem is that your function creates a new figure each time.
  댓글 수: 2
Kobi
Kobi 2015년 1월 5일
if i will remove this row: figure(N) still i wouldn't be able to use subplot what can i do so i will still be able to use my function
Star Strider
Star Strider 2015년 1월 5일
I’m not certain what you’re doing, but I would either create the subplots first and supply the axis handle to your function, see the documentation for Make Subplot Axes the Current Axes, or create the plot and then return the axis handle to the subplot Return Subplot Axes Handle. The first requires that you supply the axis handle as an input argument to your function. The second requires that you return it as output from your function.
I leave those decisions to you, since it’s your code.

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

추가 답변 (0개)

카테고리

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