Be the first to rate this file! 41 downloads (last 30 days) File Size: 23.8 KB File ID: #25426

Legend to latex converter

by Emile Demarteau

 

28 Sep 2009 (Updated 26 Nov 2009)

Code covered by the BSD License  

This function converts a Matlab legend to a text annotation for latex interpretation.

Download Now | Watch this File

File Information
Description

LEGEND2LATEX(FIGURE_HANDLE) Converts the present legends in the figure to legends that can be postprocessed using LaPrint.

Note that all earlier legend2latex objects are removed.

Can convert several line types and markers, but all may not look equally well. Ideally used in combination with LaPrint and a latex interpreter that uses the AMS math package (for the markers).

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
LaPrint

MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files Example/figure1.eps,
Example/figure1.tex,
Example/figure2.pdf,
Example/sample_latex2pdf.m,
legend2latex.m,
license.txt,
pdfcrop.pl,
plot2pdf.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
19 Oct 2009 Diane Bastien

Could you please give an example of how to use your program? What type FIGURE_HANDLE has to be?
Thanks

28 Oct 2009 Emile Demarteau

Hi Diane,

See below for an example of how this file can be used. I noted that the figure_handle is different from the figure_handle as expected by LaPrint. I use a direct handle, where LaPrint uses the figure number.

Good luck,
Emile

%%%%% EXAMPLE %%%%%%
set(0,'defaulttextinterpreter','none');
x = [0:0.1:(2*pi)];
fig1 = figure(1);
plot(x,sin(x),x,cos(x));
legend('sin($\theta$)','cos($\theta$)');
xlabel('$0 \leq \theta \leq 2\pi$')
legend2latex(fig1);
laprint(1,'figure1');

Please login to add a comment or rating.
Updates
26 Nov 2009

The updated version can also handle stem, area and bar graphs.

Tag Activity for this File
Tag Applied By Date/Time
latex Emile Demarteau 28 Sep 2009 10:59:31
laprint Emile Demarteau 28 Sep 2009 10:59:31
print Emile Demarteau 28 Sep 2009 10:59:31
export Emile Demarteau 28 Sep 2009 10:59:31
documents Emile Demarteau 28 Sep 2009 10:59:31
latex Chirackel Yoonus 10 Dec 2009 03:58:15
 

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