How to I make data evenly spaced when displaying on a plot?
3 views (last 30 days)
Show older comments
I have a figure that plots seismograms sorted by distance to the event (closest to the bottom). However, when it plots, the seismograms are not evenly spaced, so it looks like a mess and they overlap a lot, especially when the recievers (whats collecting the data) are close together. How can I make each one evenly spaced, but still sorted?
figure; hold on
for i = 1 : length(sort_dists)
indk = dist_ind(i);
plot(((1:length(fseis)))/isps, fseis(:,indk)./max(abs(fseis(:,indk)))+ deg2km(sort_dists(i)));
text(seis_duration_sec,deg2km(sort_dists(i)),num2str(deg2km(sort_dists(i))));
end
2 Comments
dpb
on 14 Oct 2021
Be far easier to have a sample dataset for folks to play with to see just what a given single plot looks like as well as to experiment...very difficult to guess what the data itself ought to look like in order to try to simulate something realistic.
The normal way to plot against a non-numeric axis would be to use the ordinal position as the abscissa instead of the numeric values; that works for a given trace.
In your case where you're trying to separate traces, that may be "not so much".
Possibly instead of the distance metric itself you should convert it to a categorical variable instead that is ordinal by the sorted distance.
Again, without seeing just what it is that we've got to work with, it's a wild guess.
I don't think the strips plot is what you're looking for here; it breaks up a given trace into sections; you've got a bunch of different traces. What might serve that is a builtin specialty plot could be stackedplot that is a bunch of small plots lined up on top of each other vertically in the overall figure window. I dunno how satisfactory that might be because they won't be overlaid at all as with the single axis you presently have.
Again, attach at least a representative dataset as a .mat file
Answers (1)
See Also
Categories
Find more on Data Distribution Plots 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!