MATLAB: How to create a pictogram in MATLAB

barimageimreadMATLABpictogram

Is it possible to create a pictogram in MATLAB?
I want to have a bar chart and for the height of the bar have 1 image.

Best Answer

You can use "imread" and "image" in a a for-loop to create a pictogram.
>> x = [1 2 3 4];
>> y = [2 4 3 2];
>> im = imread('peppers.png');
>> figure
>> hold on
>> xPos = [1 0.1];
>> yPos = [1 0.1];
>> for i = 1:numel(x)
>> xPos = xPos + 1;
>> for j = 1:y(i)
>> image(xPos, yPos, im)
>> yPos = yPos + 1;
>> end
>> yPos = [1 0.1];
>> end