Plot Formatting & Labels in MATLAB

🎨 Plot Formatting & Labels in MATLAB
Proper formatting is essential for reports, presentations, exams, and research papers.
MATLAB is developed by MathWorks.
🔹 Why Plot Formatting Is Important?
Improves readability
Makes graphs self-explanatory
Helps in comparison & interpretation
Required in academic & professional work
1️⃣ Adding Title and Axis Labels
📌 Always label axes to explain what data represents.
2️⃣ Adding Legend
Used when multiple plots are present.
3️⃣ Changing Line Style, Color & Marker
🔸 Format Breakdown
r→ red color--→ dashed lineo→ circle markerLineWidth→ thickness of line
4️⃣ Grid On / Off
or
📌 Grid improves value estimation.
5️⃣ Axis Control
📌 Format:axis([xmin xmax ymin ymax])
6️⃣ Font Size & Style Customization
7️⃣ Adding Text on Plot
📌 Useful for highlighting important points.
8️⃣ Marker Customization
9️⃣ Background & Figure Control
🔟 Complete Formatted Plot Example
⚠️ Important Notes
Use clear titles & labels
Avoid overcrowding the plot
Legends should not hide data
Consistent formatting improves clarity
🎯 Interview Questions: Plot Formatting & Labels
🔹 Q1. Which functions are used to label axes?
Answer: xlabel() and ylabel()
🔹 Q2. How do you add a title to a plot?
Answer: Using title()
🔹 Q3. What is the use of legend()?
Answer: To identify multiple plots.
🔹 Q4. How do you turn grid lines on?
Answer: Using grid on
🔹 Q5. How do you change line width?
Answer: Using 'LineWidth' property.
🔹 Q6. Which function is used to add text inside a plot?
Answer: text()
🔹 Q7. What does axis() do?
Answer: Controls axis limits.
✅ Summary
Formatting makes plots professional
Labels, title, legend are essential
Grid & axis improve readability
Required for exams, reports & research
