Hi, I was wondering if it is possible to include the actual images as x-values. So instead of image names, put the actual images. Has anyone done that before?
MATLAB: Images as bar x-values
barx-asis
Related Solutions
The answer was to use "Patch" instead of "line" and patch together circles on all the points, it works extremely well now. If anybody else wants the code, just contact me, otherwise I will probably be putting it on the file exchange when I am done with the project.
Thanks for the help ImageAnalyst!
The handle is handles.panel1. You use that instead of the actual number. For what it's worth, here is the progress bar code I use:
%--------------------------------------------------------------------
% Displays a progress bar on the figure at the specified location.
% percentageDone should be a number between 0 and 1.
function handleToProgressBar = DisplayProgressBar(varargin) %DisplayProgressBar: A progress bar that can be embedded in a GUI figure.
% Syntax and sample calling:
% progressBarPosition = [.007 .46 .38 .027]; % Position of progress bar in normalized units.
% handleToProgressBar = DisplayProgressBar(progressBarPosition);
% for k = 1:100
% percentageDone = k / 100;
% DisplayProgressBar(handleToProgressBar, percentageDone)
% end
% % Delete the progress bar. Make it disappear.
% delete(handleToProgressBar);
% Written by Doug Schwarz, 11 December 2008
try if ishandle(varargin{2}) % Progress Bar axes exist already. Just need to set the value.
handleToProgressBar = varargin{2}; %msgboxw('Progress bar already exists.');
value = varargin{3}; % Percent done, in the range 0-1.
numberOfImagesAlreadySnapped = int32(varargin{4}); grandTotalOfImages = int32(varargin{5}); p = get(handleToProgressBar, 'Child'); x = get(p, 'XData'); x(3:4) = value; set(p, 'XData',x); caption = sprintf('%d of %d Images = %.2f%%Done', numberOfImagesAlreadySnapped, grandTotalOfImages, value*100); title(handleToProgressBar, []); title(handleToProgressBar, caption); return; else % Progress Bar axes doesn't yet exist. Need to create one.
% First argument is the size (not a handle).
%msgboxw('Progress bar does not exist yet. First argument is the location and size (not a handle).');
h = varargin{1}; % Get the handles structure.
progressBarPosition = varargin{2}; % Make sure we're on this figure, not the calibration figure like we are if we launch this from calibrate().
figure(h.figMainWindow); drawnow; if length(progressBarPosition) < 4 %msgboxw('Problem: length(progressBarPosition) = %d.', length(progressBarPosition));
% Should not happen. If it does, set up default.
progressBarPosition = [.007 .46 .38 .027]; end backgroundColor = [236 0 140] / 255; % Fuschia, magenta.
foregroundColor = [0 128 0] / 255; % Dark Green
handleToProgressBar = axes('Units', 'normalized',... 'Position',progressBarPosition,... 'XLim',[0 1], 'YLim',[0 1],... 'XTick',[], 'YTick',[],... 'Color', backgroundColor,... 'XColor', backgroundColor, 'YColor', backgroundColor); patch([0 0 0 0], [0 1 1 0], foregroundColor,... 'Parent', handleToProgressBar,... 'EdgeColor', 'none',... 'EraseMode', 'none'); % set(h, 'units', 'normalized');
% Set up a title for it.
title(handleToProgressBar, []); title(handleToProgressBar, '0% Done'); end catch ME message = sprintf('Error in DisplayProgressBar():\n%s', ME.message); WarnUser(message); end return; % from DisplayProgressBar()
Best Answer