1

I use matlab2tikz to efficiently save Matlab plots as vector graphics for latex documents. I have axis scaling issues compared to the Matlab plot and the one rendered in my document.

The plot from Matlab looks like this: enter image description here

However the plot rendered using matlab2tikz and inside latex appears like this: enter image description here.

Since I do not know the aspect ratio of the plot, I see both \figureheight and \figurewidth equal. I have two questions:

  1. How to maintain aspect ratio as it is in Matlab, as the ellipse's aspect ratio needs to represented accurately?
  2. Both the x-and y-axes are overflowing (whitespace around the shaded plot). How to avoid this?
2
  • For 1., if you don't specify the width and height in the call to matlab2tikz, does that give you the correct aspect ratio? For 2., see if adding enlargelimits=false to the axis options in the generated file helps. Nov 24, 2016 at 20:14
  • For 1: I did not specify the width and height. Then, I get equal axis scales. However, the image is too large in tex document. I tried to scale it down. Then the plot fonts also decrease. For 2: It works! Please post it as answer!
    – SKPS
    Nov 25, 2016 at 11:00

1 Answer 1

2

Try using something like

matlab2tikz('filename.tex','width','\figwidth','extraAxisOptions','enlargelimits=false')

when you call matlab2tikz. It appears that when you only specify the width like this, the height is set as a fraction of \figwidth as well, so you can keep that aspect ratio. enlargelimits=false should remove the whitespace around the plot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .