createQuickPlots: Quickly Generate Professional-Quality Plot

createQuickPlots empowers you to create with just 1 line of code and quick setup time and generate publication-quality figures.
6 Downloads
Updated 16 Sep 2024

View License

createQuickPlots is a versatile MATLAB function designed to simplify the process of creating professional-quality plots. Whether you're visualizing multi-depth soil temperatures, comparing health metrics across categories, or showcasing energy production trends, this function helps you generate clear and compelling visualizations with minimal code.Features:
  • Supports Multiple Plot Types: Line, scatter, and bar plots.
  • Customizable Options: Easily customize axis labels, legends, markers, colors, and more.
  • Minimal Code: Generate publication-ready figures in a single line of code.
  • Flexible Data Handling: Handles vectors, matrices, and categorical data for versatile plotting.
  • Quick Legend and Label Formatting: Add legends and labels effortlessly, with LaTeX support for professional formatting.
Usage Examples:
Here are some examples to get you started:
1. Line Plot – Soil Temperature Variations
days = 1:180;
soil_temperatures = [15 + 5*sin(2*pi*days/180); 12 + 4*sin(2*pi*days/180 + pi/8); 10 + 3*sin(2*pi*days/180 + pi/4)]';
createQuickPlots(days, soil_temperatures, 'line', 'XLabel', 'Day of Growing Season', ...
'YLabel', 'Soil Temperature (°C)', 'LineWidth', 2, ...
'MarkerType', 'o', 'MarkerSize', 6, 'Legend', {'10cm', '20cm', '30cm'}, 'lgndTitle', 'Soil depth');
2. Scatter Plot – BMI vs. Cholesterol Levels
num_patients = 150;
bmi = 18 + randn(num_patients, 1) * 5;
cholesterol_levels_low = 180 + bmi * 1 + randn(num_patients, 1) * 10;
cholesterol_levels_medium = 200 + bmi * 2 + randn(num_patients, 1) * 15;
cholesterol_levels_high = 240 + bmi * 3 + randn(num_patients, 1) * 20;
cholesterol_data = [cholesterol_levels_low, cholesterol_levels_medium, cholesterol_levels_high];
createQuickPlots(bmi, cholesterol_data, 'scatter', 'XLabel', 'BMI', ...
'YLabel', 'Cholesterol Level (mg/dL)', 'MarkerType', 'o', ...
'MarkerSize', 20, 'Legend', {'Low', 'Medium', 'High'}, 'lgndTitle', 'Risk categories');
3. Bar Plot – Energy Production by Source
years = categorical({'2018', '2019', '2020', '2021', '2022'});
energy_production = [50, 60, 70, 80, 90; 40, 50, 65, 75, 85; 100, 110, 105, 95, 90]';
createQuickPlots(years, energy_production, 'bar', 'XLabel', 'Year', 'YLabel', 'Energy Production (TWh)', ...
'Legend', {'Solar', 'Wind', 'Fossil Fuels'}, 'ShowValues', true, 'lgndTitle', 'Energy type');
How to Use:
  1. Download the createQuickPlots.m file and add it to your MATLAB path.
  2. Call the function with your data and desired plot settings.
  3. Customize the plot using various options for labels, markers, and legends.
Requirements:
  • MATLAB R2016b or later.
Author:
Ayman Ahajjam
License:
This function is available under the MIT License.
Additional Information:
For more examples and detailed instructions, visit the [Medium article link] for a comprehensive overview of createQuickPlots.

Cite As

Aymane ahajjam (2024). createQuickPlots: Quickly Generate Professional-Quality Plot (https://www.mathworks.com/matlabcentral/fileexchange/172760-createquickplots-quickly-generate-professional-quality-plot), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0