How can I plot more than 20 files in single figures ?
5 次查看(过去 30 天)
显示 更早的评论
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
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
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
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
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 Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!