Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dimension too large axis #57

Closed
kattelk opened this issue Dec 31, 2011 · 2 comments
Closed

dimension too large axis #57

kattelk opened this issue Dec 31, 2011 · 2 comments

Comments

@kattelk
Copy link

kattelk commented Dec 31, 2011

I am not sure if this is a problem with matlab2tikz, or a problem with the plotting in MATLAB.

Take the short example

test=[-1e6,0;-1,1;-1,-1;-10,0];
plot(test(:,1),test(:,2),'.')
axis([-2,0,-2,2])

In the tikz file the axis is saved as it should be. However there are two problems with the points that fall outside the axis. Firstly, the point (-10,0) is recorded incorrectly as (-8.5,-0.166667), which is a problem if I want to come back and expand the axes later, but perhaps this is not one of the intended functions of matlab2tikz. The second more serious error is that the when compiling the error "dimension too large" appears. If the entry corresponding to (-1e6,0) is removed, then the document is able to be compiled.

@nschloe
Copy link
Member

nschloe commented Dec 31, 2011

I looked at the code and found a bug in moveCloser(); that's fixed now.
https://github.com/nschloe/matlab2tikz/commit/6fc70d9b504014e2de89df3fabd5d5d8709f8b43

The reason why the values don't appear as specified by MATLAB is that they are projected onto a bounding box around the axes; that way we can deal with far outliers, and is useful for lines plots. If the points aren't connected at all, this isn't necessary but it doesn't hurt either. Zooming of course doesn't work.

It may be useful to project the points onto a bounding box much larger than now, something around the TeX limits. I don't know what those are though, and they may even be machine-dependent.

@nschloe nschloe closed this as completed Dec 31, 2011
@nschloe
Copy link
Member

nschloe commented Dec 31, 2011

Check out

x = [ -1.0e2, -1, -1,  -1.0e2, -10,  -0.5, 0.5, 10,    1.0e2, 1,   1,    1.0e2, 10,     0.5, -0.5, -10,   -1.0e2 ];
y = [ -10, -0.5,  0.5, 10,     1.0e2, 1,   1,   1.0e2, 10,    0.5, -0.5, -10,   -1.0e2, -1,  -1,   -1.0e2, -0.5 ];
plot( x, y,'o-');
axis( [-2,2,-2,2] );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants