필터 지우기
필터 지우기

Stretch Yaxis to increase gap between data points in scatter plot

조회 수: 4 (최근 30일)
SBinary
SBinary 2019년 1월 9일
댓글: SBinary 2019년 1월 9일
Hi,
I would like to create a plot similar to the one inserted below (see black and white figure). In my attempts at reproducing the plot the datapoints are too close together along the Yaxis (see colored figure inserted below). Would anyone be able to point me into the right direction for solving this? I would be extrmeely grateful!
For reference, this is the code I am using for the plot:
figure
% Model{x} the result of a regression model
h = plot(Model{1}.Coefficients.Estimate(2), 1, '*')
hc = h.Color;
sd_vct = Model{1}.coefCI;
errorbar(Model{1}.Coefficients.Estimate(2),1,sd_vct(2,1), 'horizontal','color', hc);
xlim([-0.5 0.5])
% set(gca,'ytick',linspace(0,147,13))
hold on
for k = [1:147]; % 1:147;
h = plot(Model{k}.Coefficients.Estimate(2), k, '*') % spaceInPlot(k)
hc = h.Color;
sd_vct = Model{k}.coefCI;
errorbar(Model{k}.Coefficients.Estimate(2),k,sd_vct(2,1), 'horizontal','color', hc);
end
hold off
Milberg_reprod_avswh.png
Milbergetal_copy.png

채택된 답변

Adam
Adam 2019년 1월 9일
편집: Adam 2019년 1월 9일
Your y position is just specified as being k, which increments in steps of 1. Just change to using something else, e.g. 3*k in:
errorbar( Model{k}.Coefficients.Estimate(2), 3*k, sd_vct(2,1), 'horizontal','color', hc );
or whatever you want. You have complete control over that y value for each plot.
Or just resize your figure, because whatever the y spacing, if you have to fit 150 plots on top of each other in the same space then they will still take up the same room irrespective of the y distance.
  댓글 수: 1
SBinary
SBinary 2019년 1월 9일
Thanks, Adam!
Your y position is just specified as being k, which increments in steps of 1. Just change to using something else, e.g. 3*k.
I did indeed try this but as you note in the end of your message, the issue is that I am still using the same amount of space! See inserted image.
Or just resize your figure, because whatever the y spacing, if you have to fit 150 plots on top of each other in the same space then they will still take up the same room irrespective of the y distance.
Hence, this is probably what I will have to do. For example, plot a sub-sample of the data and then resize the plots to a size I am happy with.
Thanks again! I was wondering if there was a more elegant solution that I was missing.
untitled.png

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by