How to I make data evenly spaced when displaying on a plot?

조회 수: 3 (최근 30일)
Sarah Nolt-Caraway
Sarah Nolt-Caraway 2021년 10월 14일
댓글: dpb 2021년 10월 14일
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
Sarah Nolt-Caraway
Sarah Nolt-Caraway 2021년 10월 14일
Here is an example of a plot
dpb
dpb 2021년 10월 14일
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

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

답변 (1개)

Kevin Holly
Kevin Holly 2021년 10월 14일
Have you tried using strips?

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by