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:
- Download the createQuickPlots.m file and add it to your MATLAB path.
- Call the function with your data and desired plot settings.
- 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.
引用格式
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. 检索时间: .
MATLAB 版本兼容性
创建方式
R2024a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |