MATLAB figure/plot display issue

5 visualizzazioni (ultimi 30 giorni)
Yale Brewer
Yale Brewer il 19 Lug 2015
plotting histograms or error bars for example, the bin divisions (the border to the bins) does not display, neither do for example error bars on a series of points plotted, yet if I copy the figure into say word or powerpoint, they are definitely there - even in the editor they do not show correctly even though they seem to be enabled.
anyone had this problem or no of a possible cause/solution? thank you in advance! (R2015a)
  2 Commenti
dpb
dpb il 19 Lug 2015
Show us what you've done and attach a figure with comment of what you expect but don't get. Oh, and with the new graphics engine, the Matlab release would be good to know.
Yale Brewer
Yale Brewer il 20 Lug 2015
dpb, R2015a is the release as mentioned in the question. please also see my response to Muhammad Usman Saleem below

Accedi per commentare.

Risposte (1)

Muhammad Usman Saleem
Muhammad Usman Saleem il 20 Lug 2015
%# random data
a = [(1:30)' rand(30,1)]; %'#
%# compute edges (evenly divide range into bins)
nBins = 10;
edges = linspace(min(a(:,2)), max(a(:,2)), nBins+1);
%# compute center of bins (used as x-coord for labels)
bins = ( edges(1:end-1) + edges(2:end) ) / 2;
%# histc
[counts,binIdx] = histc(a(:,2), edges);
counts(end-1) = sum(counts(end-1:end)); %# combine last two bins
counts(end) = []; %#
binIdx(binIdx==nBins+1) = nBins; %# also fix the last bin index
%# plot histogram
bar(edges(1:end-1), counts, 'histc')
%#bar(bins, counts, 'hist') %# same thing
ylabel('Count'), xlabel('Bins')
%# format the axis
set(gca, 'FontSize',9, ...
'XLim',[edges(1) edges(end)], ... %# set x-limit to edges
'YLim',[0 2*max(counts)], ... %# expand ylimit to accommodate labels
'XTick',edges, ... %# set xticks on the bin edges
'XTickLabel',num2str(edges','%.2f')) %'# round to 2-digits
%# add the labels, vertically aligned on top of the bars
hTxt = zeros(nBins,1); %# store the handles
for b=1:nBins
hTxt(b) = text(bins(b), counts(b)+0.25, num2str(a(b==binIdx,1)), ...
'FontWeight','bold', 'FontSize',8, 'EdgeColor','red', ...
'VerticalAlignment','bottom', 'HorizontalAlignment','center');
end
%# set the y-limit according to the extent of the text
extnt = cell2mat( get(hTxt,'Extent') );
mx = max( extnt(:,2)+extnt(:,4) ); %# bottom+height
ylim([0 mx]);
I hope you are looking for this:
  8 Commenti
dpb
dpb il 22 Lug 2015
One thing to try with these kinds of issues is to change the 'renderer' property for the figure and see if that makes a difference.
You can also see if there is an updated driver for the particular graphics card from the vendor; on the rare occasion that has helped here (altho it's been years since that was such an issue it seems as in days of yore).
I'd suggest this may be a fignewton of the new graphics engine; submit the problem with sample code to official support at www.mathworks.com I don't have the later versions (not enough memory/horsepower) so can't check out anything w/ HG2 directly.
Muhammad Usman Saleem
Muhammad Usman Saleem il 23 Lug 2015
please accept my answer if you understand the problem .Regards

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by