在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):djoshea/matlab-save-figure开源软件地址(OpenSource Url):https://github.com/djoshea/matlab-save-figure开源编程语言(OpenSource Language):MATLAB 100.0%开源软件介绍(OpenSource Introduction):SaveFigure: Matlab vector figure exportSaveFigure is a Matlab utility which provides aesthetically pleasing figure export which provides a few essential features not present in Matlab's built in figure export or any known utility on the FileExchange:
I've found the outputs to be more consistent, more faithful to the on-screen displayed figure, and more aesthetically pleasing than other excellent alternatives, including export_fig by Oliver Woodford and Yair Altman and savefig by Peder Axensten. Please note that this submission includes code copied wholesale from Juerg Schwizer, Oliver Woodford, Yair Altman, and Peder Axensten. To achieve faithful, WYSIWYG vector reproduction of Matlab figures, we generate SVGs, then convert to PDF using Inkscape, and then to PNG and EPS if requested using ImageMagick's InstallationSaveFigure requires ImageMagick and inkscape to be installed and accessible from the command line in order to run. The easiest way to accomplish this is to run: Linux:
Mac:
Windows: not working yet, should be doable. If you'd like to help, I'm happy to accept pull requests! UsageSave to specific file type:
Save to set of file types, return full file names:
If fileName has no extension, the figure will be saved in multiple formats as specified by the 'ext' parameter value pair. If no 'ext' is specified, the default list is DemoFrom % Plot scatter plot with alpha blending
randseed(1); figure(1); clf;
N = 500; dx = randn(N, 1); dy = randn(N, 1);
h = plot(dx, dy, 'o', 'MarkerFaceColor', [0.6 0.6 1], 'LineWidth', 0.1, ...
'MarkerEdgeColor', 'w', 'MarkerSize', 8);
setMarkerOpacity(h, 0.3, 0.6);
hold on
N = 500; dx = randn(N, 1) + 1; dy = randn(N, 1);
h = plot(dx, dy, 'o', 'MarkerFaceColor', [1 0.6 0.6], 'LineWidth', 0.1, ...
'MarkerEdgeColor', 'w', 'MarkerSize', 8);
setMarkerOpacity(h, 0.3, 0.6);
xlabel('Param 1'); ylabel('Param 2'); title('SaveFigure Demo');
box off; axis equal;
saveFigure('demoScatter.png') % Plot timeseries with translucent error regions
randseed(2);
K = 6; N = 1000; t = (0:N-1) - 100;
y = sgolayfilt(randn(N, K), 3, 99, [], 1);
ye = sgolayfilt(randn(N, K) * 0.5, 3, 99, [], 1);
figure(2), clf; hold on;
cmap = parula(K);
for k = 1:K
% errorshade defined below
errorshade(t, y(:, k), ye(:, k), cmap(k, :), 'errorAlpha', 0.5, 'lineAlpha', 0.9);
end
box off; xlim([0 800]);
xlabel('Time'); ylabel('Signal'); title('SaveFigure Demo');
saveFigure('demoTimeseries.png'); Line and Marker OpacityIncluded in the repo are two utilities setLineOpacity(hLine, edgeAlpha) and setMarkerOpacity(hLine, markerFaceAlpha, markerEdgeAlpha) In newer versions of MATLAB, this opacity setting will occur directly on the graphics handle and alter the appearance of the Matlab figure. In older versions of Matlab where these opacity settings are not supported, these settings will be stored in the UserHandle of the figure, where saveFigure will search for the setting upon saving. Thus, the opacity will not be visible in Matlab but will be reflected in the saved PDF, PNG, or EPS file. CreditsaveFigure internally relies heavily on (and includes within it) code from:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论