Skip to content

pcolor(X,Y,C) not working correctly #263

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

Closed
xarico10 opened this issue Aug 2, 2021 · 2 comments
Closed

pcolor(X,Y,C) not working correctly #263

xarico10 opened this issue Aug 2, 2021 · 2 comments
Assignees

Comments

@xarico10
Copy link
Contributor

xarico10 commented Aug 2, 2021

When using pcolor(X,Y,C) specifiy the x- and y-coordinates for the vertices of values in matrix C, a completely different plot is being created from expected.

X = [1 2 3; 1 2 3; 1 2 3];
Y = X';
C = [3 4 5; 1 2 5; 5 5 5];
pcolor(X,Y,C)

fig2plotly(gcf, 'offline', false);

Expected and generated (https://chart-studio.plotly.com/~xarico10/789/#/) plots:
Captura de Pantalla 2021-08-02 a la(s) 11 20 17 a  m
Captura de Pantalla 2021-08-02 a la(s) 11 20 41 a  m

Examples on using pcolor(X,Y,C) can be found on:
https://www.mathworks.com/help/matlab/ref/pcolor.html#mw_83e8289f-c7db-46ea-b8b5-7899343d24e1

@gilbertogalvis
Copy link
Contributor

PR #341 fix this issue. This issue is related to pcolor similar to issue #265. Then working with this issue I was careful to ensure that modifications works for both issues (both #263 and for #265)

codes to test:

X = [.5 2 6; .5 2 6; .5 2 6];
Y = X';
C = [3 4 5; 1 2 5; 5 5 5];
pcolor(X,Y,C)

fig2plotly(gcf, 'offline', 0, 'TreatAs', 'pcolor');
[X,Y] = meshgrid(-3:6/17:3);
XX = 2*X.*Y;
YY = X.^2 - Y.^2;
colorscale = [1:18; 18:-1:1];
C = repmat(colorscale,9,1);
pcolor(XX,YY,C);

fig2plotly(gcf, 'offline', 0, 'TreatAs', 'pcolor');

Here the results

Screen Shot 2021-08-14 at 9 35 07 AM

Screen Shot 2021-08-14 at 9 35 26 AM

Screen Shot 2021-08-14 at 9 36 12 AM

Screen Shot 2021-08-14 at 9 36 35 AM

@gilbertogalvis
Copy link
Contributor

Also, as suggested @VolKa79 in the review of PR #340. I have removed the x and y axis titles

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