MATLAB: Making plots look beautiful

plot

Hi, I made a plot which displays the condition of cars of a particular brand overtime.
What i would like to do is to make the plot beautiful in apperance for presentation. I tried movmean, smoothing, choosing larger time intervals to avoid the jittering of the data points. But none of them helped me. Can anyone suggest me an idea on how to get this done?
Plot is attached

Best Answer

Hello Hari,
I have just created a dummy data and plot them for you. You must check the line properties in documentation here the link:linespec
Please read comments carefully:
%% some random integer arrays 10x1
carsShowRoom = randi(20,10,1);
onRoad = randi(20,10,1);
good = randi(20,10,1);
bad = randi(20,10,1);
%% Time vector 1x10
time = 1:10;
figure;
hold on; % holds the axes
hPlot1 = plot(time,carsShowRoom); % hPlots are the plot handles, you can either change the properties from the handle object of the line or you can define them inside the plot function with 'propertyname',value pairs.
hPlot2 = plot(time,onRoad);
hPlot3 = plot(time,good);
hPlot4 = plot(time,bad);
hPlot1.LineStyle = '--'; % changes the line style
hPlot1.LineWidth = 2; % changes the line Width, you can get thin lines as you wish.
set(hPlot1, 'Marker', 'o'); % you can also use set function to set a property, definetely works like above. Marker adds a marker with shape you put. All of these informations are in the linespec link.
hPlot1.MarkerSize = 10;
hPlot1.MarkerEdgeColor = [0.85 0.47 0.32]; % Marker outside boundaries color
hPlot1.MarkerFaceColor = [0.1 0.25 0.89]; % Marker inside filling color
%% Note: To make your plot look beautiful use smooth colors not the defined 'r','b','c' colors they are way too bright.
% You can also use RGB color codes you can find on the internet but just be sure that Matlab gets color codes from 0 to 1 and RGB codes from 0 to 255. So you should interpolate it.
% For ex:
ColorCode = [148 130 78]./255; % Dividing 255 gives you the 0-1 value.
hPlot2.Color = ColorCode;
hPlot1.Color = 'c'; % As I said above don't use these bright colors.
%% Another important note:
% You can also use get method to see what properties and methods are defined for the line object
get(hPlot1)
%% gives you the below result:
AlignVertexCenters: 'off'
Annotation: [1×1 matlab.graphics.eventdata.Annotation]
BeingDeleted: 'off'
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: 'on'
Color: [0 0.4470 0.7410]
CreateFcn: ''
DeleteFcn: ''
DisplayName: ''
HandleVisibility: 'on'
HitTest: 'on'
Interruptible: 'on'
LineJoin: 'round'
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerEdgeColor: 'auto'
MarkerFaceColor: 'none'
MarkerIndices: [1 2 3 4 5 6 7 8 9 10]
MarkerSize: 6
Parent: [1×1 Axes]
PickableParts: 'visible'
Selected: 'off'
SelectionHighlight: 'on'
Tag: ''
Type: 'line'
UIContextMenu: [0×0 GraphicsPlaceholder]
UserData: []
Visible: 'on'
XData: [1 2 3 4 5 6 7 8 9 10]
XDataMode: 'manual'
XDataSource: ''
YData: [7 10 16 3 3 6 11 20 15 7]
YDataSource: ''
ZData: [1×0 double]
ZDataSource: ''
You can also add legend and change legend location, orientation, etc... See that link: legend
I hope all these informations are useful. Just try this with running each line one by one in debug mode and see what changes in your plot figure. So you can change every property and decide what looks beautiful.
Additional Edit:
-You can use grid, xlabel and ylabel (with editing their font size, font color and font type, etc...).
-To save your figure with high resolution (I am telling this because the plot you attached has a very low resolution-you can see what I plotted below), use File Menu left top of the figure and save as .png format for high resolution to use in your MS Office.
If you still have any other questions, I can help.