Lines disappearing on plot

33 views (last 30 days)
Pavlov
Pavlov on 1 Nov 2014
Commented: Image Analyst on 2 Nov 2014
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?

Accepted Answer

Image Analyst
Image Analyst on 1 Nov 2014
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 Comments
Pavlov
Pavlov on 1 Nov 2014
Ahh I see. I am introducing it into the image itself rather than using the line function after making each image, because it's easier. I suppose I can make each segment 2-3 pixels wide to avoid this.
Thanks!
Image Analyst
Image Analyst on 2 Nov 2014
That would probably work - let us know if it doesn't. Thanks for accepting the answer.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!