Giter Site home page Giter Site logo

legend error about matlab2tikz HOT 4 CLOSED

matlab2tikz avatar matlab2tikz commented on May 29, 2024
legend error

from matlab2tikz.

Comments (4)

nschloe avatar nschloe commented on May 29, 2024

how do i reproduce this? sample figure please! (as simple as possible) :)

from matlab2tikz.

MarcelTh avatar MarcelTh commented on May 29, 2024

I have the same issue. It is caused by ylim([]) if the maxima of the plotted data is outside the ylim() range. The line stroke is then 'cut' into several plots. There's a simple workaround: set the ylim range afterwards in the .tikz figure.

You can reproduce it with the attached matlab sample. The problem only exists if ylim < [1 1] as in the example.

%%%
figure(1)
x=0:0.01:2_pi;
plot(x,sin(x),'b',x,cos(x),'r')
xlim([0 2_pi])
ylim([-0.9 0.9])
Title('\text{tikz test}')
xlabel('\text{x-Values}')
ylabel('\text{y-Values}')
legend('\sin(x)','\cos(x)');
grid on
matlab2tikz('testplot.tikz')

from matlab2tikz.

nschloe avatar nschloe commented on May 29, 2024

The reason why the graph is split into several smaller ones is to avoid that data that is not visible isn't included in the file. There have been problems in the past where the TikZ files became rather large to the point where TeX would just give up compiling, all based on off-plot data.
I'll see if Pgfplots provides a better remedy there than to add several addplot's.

from matlab2tikz.

nschloe avatar nschloe commented on May 29, 2024

Fixed; will be part of next release.

from matlab2tikz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.