I had a similar problem. Matlabs legend command does not really have correct positioning properties if the legend is outside the figure. I added some lines below the legend2latex function to adjust the position properties manually
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');
30 Sep 2009
LaPrint
LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents.
Author: Arno Linnemann
Great work! This script allowed me to perfectly markup all my figures, so they could be included nicely in my report. @Tor Aksel, I wrote a legend to latex converter to overcome the small box problem.
30 Sep 2009
LaPrint
LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents.
Author: Arno Linnemann
This solution works perfectly for me combined with laprint, but whenever I include legend2latex i lose the marker information stored within the legend.
I had a similar problem. Matlabs legend command does not really have correct positioning properties if the legend is outside the figure. I added some lines below the legend2latex function to adjust the position properties manually
is the any possibility of locating the legend elsewhere? Just like in the legend command " ..., 'Location', 'EastOutside' ..." etc.? Would be a great help.
Thanks for sharing your script by the way!
Unfortunately, the function does not work for me on histograms, I assume to all similar functions. Is it possible to extend this? Does this only have to do with the fact that it can not find appropriate line styles/markers in this case?