How can I plot more than 20 files in single figures ?

조회 수: 3 (최근 30일)
Shiba Subedi
Shiba Subedi 2016년 12월 5일
댓글: Image Analyst 2016년 12월 6일
I have more than 20 SAC files to plot in a single figure. Using Matlab how can I plot these data? Thank you in advance!
  댓글 수: 1
Adam
Adam 2016년 12월 5일
20 plots in a single figure is a lot. Programmatically using subplot as suggested by Image Analyst is simplest, but depending what you are plotting and whether you want axes labels, ticks, etc subplot can be a bit wasteful of space (if you don't want any axes labels) so you may be better creating and positioning 20 axes yourself in a 5*4 or 4*5 or 10*2 or whatever suits you grid. This is very simple maths and you can control the space between the axes yourself.

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

답변 (1개)

Image Analyst
Image Analyst 2016년 12월 5일
What is an "SAC" file? If you have data, you can use plot(), bar(), surf(), etc. depending on how you want to display it. You might also find subplot() useful if your figure contains nothing else except your 20 plots:
subplot(4, 5, 1);
plot(x1, y1);
subplot(4, 5, 2);
plot(x2, y2);
etc.
  댓글 수: 3
Adam
Adam 2016년 12월 6일
It would really help if you use Matlab terminology. You seem to be using 'figure' to mean both figure, axes and line plot. A figure is a UI frame with a title bar which can contain many axes and an axes can contain many plots. What exactly is it that you are aiming for?
The notion of files is totally separate from plotting. Once you load the files in they just become data within Matlab, either 1 dataset or many.
Image Analyst
Image Analyst 2016년 12월 6일
To make 20 line plots in 20 axes (one line plot per axes control) on a single figure (window), then use subplot like this:
subplot(20, 1, 1);
plot(x1, y1);
subplot(20, 1, 2);
plot(x2, y2);
....
subplot(20, 1, 19);
plot(x19, y19);
subplot(20, 1, 20);
plot(x20, y20);

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

카테고리

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