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

Matrix plotting with quadratic matrix #95

Open
behinger opened this issue Mar 25, 2020 · 1 comment
Open

Matrix plotting with quadratic matrix #95

behinger opened this issue Mar 25, 2020 · 1 comment
Labels

Comments

@behinger
Copy link

Hi!
Great toolbox, I am using it heavily in https://github.com/unfoldtoolbox/unfold.

I right now ran into a problem: I am making use of the automatic matrix expansion for "y" with a vector for "x". But if "y" is quadratic then it does not work correctly. I give a reproducible example here:

a = [0 0 1 1 0 0;
     0 0 2 2 0 0;
     0 0 3 3 0 0;
     0 0 4 4 0 0;
     0 0 5 5 0 0;
     0 0 6 6 0 0;]
 b = 1:6;
 figure
 g = gramm('x',b,'y',a)
 g.geom_line()
 g.draw()

This looks like this:
grafik

Removing just a single row, making the matrix 5x6 results in the "correct" (for me expected) behaviour:

 g = gramm('x',b,'y',a(1:5,:))
 g.geom_line()
 g.draw()

grafik

I expected the first plot to look like the second one, just with 6 lines instead of 5. Any way to force the behaviour to the second case?

Thanks a ton for your help!

@piermorel
Copy link
Owner

Hi @behinger,

Thanks for the feedback. That must be an issue with gramm trying to be clever figuring out how the data is organized in order to "extend" x... which probably fails when the matrix is squared. I'll look into it when I have more time. For now, in your case it's easy to solve in your toolbox by providing an already extended x :
g = gramm('x',repmat(b,size(a,1),1),'y',a)

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

No branches or pull requests

2 participants