How can I plot more than 20 files in single figures ?
5 views (last 30 days)
Show older comments
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 Comment
Adam
on 5 Dec 2016
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.
Answers (1)
Image Analyst
on 5 Dec 2016
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 Comments
Adam
on 6 Dec 2016
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
on 6 Dec 2016
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);
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!