简介
PlotPub 是一个免费和开放源的MATLAB绘图库,用于生成MATLAB漂亮的,出版质量的图。从名字可以看出,该工具包主要是plot绘制一些曲线。
下载安装
下载:https://github.com/masumhabib/PlotPub
安装:addpath('D:/MATLAB/PlotPub-master/lib');
解压后将路径添加到Matlab的环境中即可。
去除路径
rmpath('D:/MATLAB/PlotPub-master/lib');
例子
官方例子:https://github.com/masumhabib/PlotPub
clear all; close all; clc
%% lets plot 3 cycles of 50Hz AC voltage
f = 50; % frequency
Vm = 10; % peak
phi = 0; % phase
% generate the signal
t = [0:0.0001:3/f];
th = 2*pi*f*t;
v = Vm*sin(th+phi);
% plot it
figure;
plot(t*1E3, v);
% change settings
plt = Plot(); % create a Plot object and grab the current figure
plt.XLabel = 'Time, t (ms)'; % xlabel
plt.YLabel = 'Voltage, V (V)'; %ylabel
plt.Title = 'Voltage as a function of time'; % plot title
% Save? comment the following line if you do not want to save
% plt.export('plotSimple1.png');
% plot it
figure;
plot(t*1E3, v);
plt = Plot(t*1E3, v); % create the figure directly using data
plt.XLabel = 'Time, t (ms)'; % xlabel
plt.YLabel = 'Voltage, V (V)'; %ylabel
plt.Title = 'Voltage as a function of time'; % plot title
plt.Colors = {[0, 0, 0]}; % [red, green, blue]
plt.LineWidth = 2; % line width
plt.LineStyle = {'--'}; % line style: '-', ':', '--' etc
plt.YScale = 'log'; % 'linear' or 'log'
plt.YLim = [1E-3, 1E3]; % [min, max]
plt.YTick = [1E-3, 1E-1, 1E1, 1E3]; %[tick1, tick2, .. ]
plt.YGrid = 'on'; % 'on' or 'off'
总结
该包比较小,使用也比较简单,功能比较单一,不过对于plot进行了很好的封装,便于绘制plot图。