Be the first to rate this file! 82 downloads (last 30 days) File Size: 27.12 KB File ID: #20813

BaFigExPro (v. 2.5.1)

by Jonathan Rossel

 

22 Jul 2008 (Updated 11 Jan 2010)

Code covered by the BSD License  

Batch figure export processing with uniform styling.

Download Now | Watch this File

File Information
Description

The BaFigExPro package provides an automatic method to export Matlab figures, with optional uniform styling. Several input/output folders can be given in a single call. The routine works both for windows and linux (tested on Matlab 6.5 and 7.x).

The package is generally used to:

- make uniform figure styling with batch processing. Styling includes font size, marker size, line width, color, legend position, ticks locking and figure dimensions.

- export figures to eps and optionally pdf, jpeg, png and tiff files. By using the eps file as an intermediate file for the other format, the typical huge white blank frame around the figures that Matlab adds when exporting in other formats is not present. The routine can also be used to export with any Matlab print format.

- prepare tex code for figure inclusion.

- automate 2 standard output styles:
*article: smaller fonts and line widths
*slides: bigger fonts and line widths

- special features:
*axes size adaptation to follow font size or figure dimension changes
*option to assure that text blocks are kept within the axes boundary
*wide number of options (recursive, subset of files, preview, ...)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UPDATE description

(v. 2):

    * 7.x compliant
    * Automatic (simple) latex code generation option
    * Recursive on folders
    * Reset legend position option
    * Matchcolorbar option (not active for 7.x)
    * Interpolate option for ghostscript added

(v. 2.1)
    * Bug correction

(v. 2.2)
    * 7.x automatic resizing for slides export improved

(v. 2.3)
    * Small bug corrected in formatfig.m
    * 'latexcodeonly' option added

(v. 2.4)
    *'fsubset' option added
    *allow option structure input
    *'eps_renderer' option added
    *color handling redesigned, bw conversion greatly improved
    *'recursive' option more robust

(v. 2.5)
    *fig files having dots in their name are allowed
    *latex interpreter restored if lost at saving
    *'activeposition' and 'marginfactor' options added as resizing parameters
    *'stylemap': behaviour slightly modified to allow unique Matlab style
    *undock figures before formatting if necessary

(v. 2.5.1)
    *bug corrected in latex interpreter restoration

General comments 6.x to 7.x:

    * Figures in 7.x includes a set of hidden objects (yep, so hidden that you can't know what they are) which makes the use of "findall" a bit dangerous, or say, a good source of bugs.
    * Figures generated in 6.x can be read in 7.x but DON'T BEHAVE like if they had been created in 7.x, especially when it comes to LEGENDS or COLORBARS. So, avoid processing 6.x figures on 7.x installations.
    * The field that I used to link a colorbar to its axes has disappeared in 7.x. I know it still exists but can't find it. Any help would be welcome. 'ActivePositionProperty' does not care about axes-colorbar matching...
    * The colorbar properties tend to be reset when saving-closing-opening a figure.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Motivations:

I was basically fed up with doing all that stuff manually. Why restart all the formatting for a presentation when the figures are already nicely prepared for an article?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
History:

The package is based on eps2xxx by Primoz Cermelj (slightly modified) and exportfig by Ben Hinkle (greatly modified). After a thorough testing of exportfig, I saw that it was not working fine for many cases that I was needing (e.g. figures with large labels for presentations). So, I nearly rewrote it and added some cool stuff.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Usage:

Unzip the package and call fig2public. Read the help headers of the different routines! The version log is also useful... In general,

1) generate and store fig files in a folder (be minimalist in terms of format processing, always use command line calls to perform them).

2) call fig2public with the source folder and the output folder as arguments. Add all the options that you need. Many are available. The options of the different subroutines can be given directly to fig2public.

3) enjoy the output. Use the tex files in the output folders to copy-paste inclusion code.

4) you might have to define the path to ghostscript somewhere.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bugs and "that stuff is useless":

Well, first go to the previous point, notably the "known limitations" in the version log. Then, e-mail me.

Enjoy!

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Exportfig, eps2xxx

MATLAB release MATLAB 7.8 (R2009a)
Other requirements Should work for any version of Matlab from 6.x to 7.x. Will work differently in 6.x and 7.x though.
Zip File Content  
Other Files addtotex.m,
eps2xxx.m,
fig2public.m,
formatfig.m,
license.txt,
version_log.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
24 Mar 2009

The main feature of this update is the compatibility with Matlab 7.x and simple TeX inclusion code generation. For the rest, read below and check the changelog file. Comments and feedback welcome.

14 Apr 2009

2.1 update: corrected a bug in FORMATFIG. (undefined "oldactopos" variable).

14 Apr 2009

2.1 update: corrected a bug in FORMATFIG (undefined variable "oldactpos")

17 Apr 2009

7.x automatic resizing for slides export improved

20 Apr 2009

Small bug corrected in formatfig.m, 'latexcodeonly' option added

25 Jun 2009

(v. 2.4)
    *'fsubset' option added
    *allow option structure input
    *'eps_renderer' option added
    *color handling redesigned, bw conversion greatly improved
    *'recursive' option more robust

21 Dec 2009

See description

11 Jan 2010

bug introduced in last update corrected

Tag Activity for this File
Tag Applied By Date/Time
graphics import Jonathan Rossel 22 Oct 2008 10:11:15
graphics export Jonathan Rossel 22 Oct 2008 10:11:15
batch Jonathan Rossel 22 Oct 2008 10:11:15
figure Jonathan Rossel 22 Oct 2008 10:11:15
processing Jonathan Rossel 22 Oct 2008 10:11:15
format Jonathan Rossel 22 Oct 2008 10:11:15
export Jonathan Rossel 22 Oct 2008 10:11:15
pdf Jonathan Rossel 25 Jun 2009 09:45:07
eps Jonathan Rossel 25 Jun 2009 09:45:07
latex Jonathan Rossel 25 Jun 2009 09:45:07
powerpoint Jonathan Rossel 25 Jun 2009 09:45:07
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com