nschloe/matlab2tikz — Issue #69: barplot does not work properly
Author: Schnet
Created: 2012-02-10 12:36:28+00:00
State: open

First of all thanks a lot for that great tool! I just found it and the output in LaTeX looks like a figure in LaTeX should look like :) Unfortunately I have 2 problems with barplots. I created two small examples to demonstrate them. If you try this code in Matlab:

figure(1);
bins = -0.5:0.1:0.5;
hist1 = [0,6,9,14,12,5,3,1,0,0,0];
hist2 = [0,0,0,0,0,4,9,27,16,20,10];
bar(bins,[hist1;hist2]',2);
matlab2tikz( 'plot1.tikz', 'height', '\figureheight', 'width', '\figurewidth' );

and you then include plot1.tikz in LaTex then it shows some thicker bars that should not be there. As one result the overlapping area is not visible anymore.
Another problem that I have is the following:

figure(2);
bins = -0.5:0.1:0.5;
hist1 = [1,2,4,2,1,0,0,0,0,0,0];
bar(bins,hist1);
hold on;
hist2 = [0,0,0,0,0,1,2,4,2,1,0];
bar(bins,hist2);
matlab2tikz( 'plot2.tikz', 'height', '\figureheight', 'width', '\figurewidth' );

In this case there is a gab between the two histograms that should not be there. Can anyone help me with that?