Log axis, and images
Hi!
matlab2tikz is really a great script! two remarks:
1. even if matlab is limited to plot log plots in base 10, pgfplot is not. I suggest adding the 'base' option, and print the tikz file with the correct info:m2t.opts.addParamValue( 'base', 10, @isinteger );
in the main function, then something like this:if ~isXLog && ~isYLog
env.name = 'axis';
elseif isXLog && ~isYLog
env.name = 'semilogxaxis';
if m2t.opts.Results.base ~= 10,
env.appendOptions(sprintf('log base x=%d',m2t.opts.Results.base));
end
elseif ~isXLog && isYLog
env.name = 'semilogyaxis';
if m2t.opts.Results.base ~= 10,
env.appendOptions(sprintf('log base y=%d',m2t.opts.Results.base));
end
else
env.name = 'loglogaxis';
if m2t.opts.Results.base ~= 10,
env.appendOptions(sprintf('log base x=%d',m2t.opts.Results.base));
env.appendOptions(sprintf('log base y=%d',m2t.opts.Results.base));
end
end
in drawAxis. Works fine for me. Maybe it's better to have two parameters, one for each axis.
2. Currently, the drawImage function works only for one image. By adding a counter (I used a global variable, but there's certainly a nicer way to do that), I easily made it work for multiple images: [pathstr, name ] = fileparts( m2t.tikzFileName );
pngFileName = fullfile( pathstr, [name '__' sprintf('%d',imgcount) '.png'] );
pngReferencePath = fullfile( m2t.relativePngPath, [name '__' sprintf('%d',imgcount) '.png'] );
imgcount=imgcount+1;
Also, I suggest to switch to: xLim = get(handle,'XData');
yLim = get(handle,'YData');
With these modifications, I was able to plot a 2D embedding of ~100 images.
Cheers
M.
