Hi, I would like to rotate the legend from horizontal layout to vertical layout, just as shown in the picture below. Could anyone share some experience about this?
Thanks for you coming help!
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
There is no direct function to rotate legends in graphs using MATLAB.
However, as a workaround we can manually rotate the legends. Please refer to the following example:
% create a sample plot h1 = plot(1:5); % add legend to the graph [legend_handle, icons] = legend('Sample legend'); % disable the box around the legend object set(legend_handle, 'Box', 'off') % get the current position of the legend object leg_pos=get(legend_handle,'position'); % assign the required position of the legend to a new variable new_leg_pos=[.7 0.6 .2 leg_pos(4)+.2] ; % Get current line data (horizontal line)
SEE COMPLETE ANSWER CLICK THE LINK
Comments
Post a Comment