Lines disappearing on plot
조회 수: 13 (최근 30일)
이전 댓글 표시
Hey there,
I am having a weird problem with a specific type of plot I like to make. There are three pictures attached. What I am doing is making a kind of heat map, then adding 4 black lines to denote the borders of something (top image in attachment). Then what I do is concatenate several of these heat maps side-by-side to represent my data changing in time in a subplot. I initially plot using:
h1 = subplot(3,1,i); imagesc(B); colormap(gray);
Where the variable 'B' is the heat map I am plotting (as in image #1 in attachment). When I do this, however, one of the black lines I original put on B is gone (image #2). Another one of the black lines disappears when I use 'axis image' and then make the plot prettier with the code below:
axis image;
x_lims = get(gca,'xlim');
x_lng = x_lims(2)-x_lims(1);
new_ticks = round(x_lng/numEpochs*(1:numEpochs-1));
set(gca,'xtick',new_ticks)
x_tic = get(gca,'XTick');
y_lims = get(gca,'YLim');
ylabel(tag2,'FontSize',13,'FontWeight','Bold')
set(gca, 'ytick', [], 'yticklabel', [], 'CLim', [0, 255]);
set(gca,'xticklabel',XTL+stimDur,'tickdir','out','FontWeight','Bold','FontSize',12)
set(gca,'ydir','reverse'); set(gca,'LineWidth',2);
set(gca,'xtick',x_tic)
The bottom image in the attachment shows what I end up with, which is my intended subplot, except that two sides of my rectangle are missing...
Does anyone see what I can do differently to prevent this from happening?
댓글 수: 0
채택된 답변
Image Analyst
2014년 11월 1일
Did you draw the line in the image itself? Or display it in the graphical overlay with the line() function? If it's in the image and only one pixel wide, then if the image gets shrunk down for display it's possible it won't appear due to which pixels get taken when it subsamples the image.
댓글 수: 2
Image Analyst
2014년 11월 2일
That would probably work - let us know if it doesn't. Thanks for accepting the answer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!