Biomimetics and Dextrous Manipulation Lab


Beginning to put together a guide for how to make figures that combine MATLAB's plotting ability with a bit of graphic design. Work in progress as of 2/7/2023. I'll continue to update over the next months.

Step 1) Generate your graphical elements in Illustrator. Avatars can be made easily using the Pen tool as well as the image trace tool. Next, if the element will rotate (like a drone), try to make the rotation point the center of the image to make the MATLAB steps easier.

Step 2) Export with sufficient resolution -> I used PNGs with a PPI of at least 400, though the avatars should not be really large so 600 is okay.

Step 3) Make your plot in MATLAB and import the image files into MATLAB.

Step 4) Overlay images using MATLAB's image function You will need to use transparency as well, which is covered in the above URL. If you rotate the image using the imrotate function, you'll also need to rotate the image's alpha layer. These must be the same dimension.

I made functions that take in the image and its alpha layer and the rotate angle.

function plot_avatar_fn(img, angle, alphachannel, x_location, y_location, x_dims, y_dims)
[img_rotate] = imrotate(img,angle);
img_rotate_factor = size(img_rotate(:,1,1)) / size(img(:,1,1));
[alphachannel_rotate] = imrotate(alphachannel,angle);
img_frame_X_rot = [x_location x_location] + [ -x_dims x_dims]*img_rotate_factor;
img_frame_Y_rot = [y_location y_location] + [ y_dims -y_dims]*img_rotate_factor;
avatar_image = image(img_rotate, 'XData', img_frame_X_rot, 'YData',

Step 5) Export the figure at ~300 to ~600 PPI.

Page last modified on February 07, 2023, at 11:47 AM