plot problem in GUI for 2014b

조회 수: 2 (최근 30일)
Sandy
Sandy 2014년 11월 25일
댓글: Sandy 2014년 11월 25일
First of all, everything works great on 2013b until I upgrade to 2014b. I am really confused here.
The plot I want to get looks like this: There are some dashed lines in the plot.
However, after I update into 2014b, the plot shows like this: No dashed lines ...
Here is the code I was using and I did not change it after updating to 2014b
function [colorline, legendCell] = plotC(C, h, numSpec, c, ind)
lineC = plot(h, C); % plot the curve(random signal in the plot)
%%add legend (no problem here)
colorline = get(lineC,'Color');
if ~iscell(colorline)
colorline = {colorline};
end
legendCell = cellstr(num2str(ind, 'Factor %-d'));
legend(h, legendCell)
%%finish adding legend
%%add dashed lines *(problem after updating to 2014b)*
yLimits = get(h,'YLim');
hold(h,'on')
for i = 1:c - 1
plot(h, i*numSpec,linspace(yLimits(1),yLimits(2)),'Color', 'k')
end
hold(h, 'off')
%%finish adding dashed line
Thank you very much for any suggestions!
  댓글 수: 2
Adam
Adam 2014년 11월 25일
What does it look like in the plot browser? Do you have the number of plots you expect in there or is there just the original plot and nothing else?
If the plots are there (in the plot browser) do they appear when you resize the figure or are they not visible whatever you do?
Sandy
Sandy 2014년 11월 25일
Hi Adam, Thank you for your questions.
The plot I showed here is one of four plots in a single GUI panel. That's is why I use "h" as axes handles for this plot. I tried zoom in and zoom out but nothing becomes visible.
In my code, "c-1" is the total number of dashed lines. "numSpec" is the length of each segment (if dashed lines can be seen). "C" is the data shown in blue color in those 2 plots above.
My idea is to plot the "C" first and then add dashed lines at the end of each segment in order to separate them.
Hope I answered all your questions. Look forward to any suggestions.

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

채택된 답변

Brandon
Brandon 2014년 11월 25일
Is there any reason as to why you are manually defining grid lines (desired color or something)? Why don't you use the built in grid lines and see how that work:
Try:
set(gca,'XGrid','on', 'XMinorGrid','on');
or
set(gca,'XGrid','on');
  댓글 수: 2
Sandy
Sandy 2014년 11월 25일
Aha, I did not think in this way before. let me try this. Thank you, Brandon.
Sandy
Sandy 2014년 11월 25일
Thank you! Your idea works!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by