필터 지우기
필터 지우기

Plotting multiple figures using subplot

조회 수: 6 (최근 30일)
sam
sam 2022년 12월 22일
답변: VBBV 2024년 2월 26일
How I can plot like this?
Fig1 Fig2
Fig3 Fig4
Fig5 Fig6

답변 (2개)

John D'Errico
John D'Errico 2022년 12월 22일
help subplot
SUBPLOT Create axes in tiled positions SUBPLOT(m,n,p) divides the current figure into an m-by-n grid and creates an axes in the position specified by p. MATLAB® numbers subplot positions by row. The first subplot is the first column of the first row, the second subplot is the second column of the first row, and so on. If an axes exist in the specified position, then this command makes the axes the current axes. SUBPLOT(m,n,p,'replace') deletes the existing axes in position p and creates a new axes. SUBPLOT(m,n,p,'align') creates a new axes so that the plot boxes are aligned. This option is the default behavior. SUBPLOT(m,n,p,ax) converts the existing axes, ax, into a subplot in the same figure. SUBPLOT('Position',pos) creates an axes in the custom position specified by pos. Use this option to position a subplot that does not align with grid positions. Specify pos as a four-element vector of the form [left bottom width height]. If the new axes overlaps existing axes, then the new axes replaces the existing axes. SUBPLOT(___,Name,Value) modifies axes properties using one or more name-value arguments. Set axes properties after all other input arguments. ax = SUBPLOT(___) creates an Axes object, PolarAxes object, or GeographicAxes object. Use ax to make future modifications to the axes. SUBPLOT(ax) makes the axes specified by ax the current axes for the parent figure. This option does not make the parent figure the current figure if it is not already the current figure. Example: subplot(2,1,1); x = linspace(0,10); y1 = sin(x); plot(x,y1) subplot(2,1,2); y2 = sin(5*x); plot(x,y2) See also TILEDLAYOUT, NEXTTILE, SGTITLE, AXES, GCA Documentation for subplot doc subplot
  댓글 수: 1
sam
sam 2022년 12월 22일
Could you please show it with an example to get the following plot?
Fig1 Fig2
Fig3 Fig4
Fig5 Fig6

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


VBBV
VBBV 2024년 2월 26일
subplot(3,2,1)
plot(rand(2),rand(2)); title('figure 1')
subplot(3,2,2)
plot(rand(2),rand(2));title('figure 2')
subplot(3,2,3)
plot(rand(2),rand(2));title('figure 3')
subplot(3,2,4)
plot(rand(2),rand(2));title('figure 4')

카테고리

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