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

3D plot GKS: Colour index is invalid in routine SET_FILL_COLOR_INDEX #520

Open
sebastiantk opened this issue May 30, 2023 · 3 comments
Open

Comments

@sebastiantk
Copy link

Hi,
I have a 10x10 matrix with NaN values in the lower half that I want to plot in 3D:

mat = [-1.05 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0; NaN -1.1 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5; NaN NaN -1.15 -0.6666666666666667 -0.6666666666666667 -0.6666666666666667 -0.6666666666666667 -0.6666666666666667 -0.6666666666666667 -0.6666666666666667; NaN NaN NaN -1.2 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75; NaN NaN NaN NaN -1.25 -0.8 -0.8 -0.8 -0.8 -0.8; NaN NaN NaN NaN NaN -1.3 -0.8333333333333334 -0.8333333333333334 -0.8333333333333334 -0.8333333333333334; NaN NaN NaN NaN NaN NaN -1.35 -0.8571428571428572 -0.8571428571428572 -0.8571428571428572; NaN NaN NaN NaN NaN NaN NaN -1.4 -0.875 -0.875; NaN NaN NaN NaN NaN NaN NaN NaN -1.45 -0.8888888888888888; NaN NaN NaN NaN NaN NaN NaN NaN NaN -1.5]
Apologies for providing the data like this.

If I plot this with camera = (80,30) I get the above mentioned error:

plt = plot(1:10, 1:10, mat, st=:wireframe, camera=(80, 30), xlabel=L"M", ylabel=L"n", zlabel=L"\bar{\lambda}_{\max}", legend=false, yflip=false, xflip=false)
surface!(1:10, 1:10, mat, alpha=0.8)

and this preview in my VS Code plots pane
surface_black_screenshot

If I save it as a png using savefig() it seems to encounter another issue because it adds some black lines to the plot:
surface_black

If I change the camera angle to e.g. (150,30)

plt = plot(1:10, 1:10, mat, st=:wireframe, camera=(150, 30), xlabel=L"M", ylabel=L"n", zlabel=L"\bar{\lambda}_{\max}", legend=false, yflip=false, xflip=false)
surface!(1:10, 1:10, mat, alpha=0.8)

then I do not get the error/warning and the preview looks colored except that now the position of the axis is not ideal:
surface_color_screenshot

However, again if I save it adds some black lines
surface_color

I tried the same procedure using the pyplot() backend but there were no issues. Also changing the NaN to missing results in the same behavior. If I replace the with nothing then everything works but the nothing values appear in the plot at some high level.

I am on
Julia Version 1.9.0
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 10 × Apple M2 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
Threads: 1 on 6 virtual cores

and my Plots.GR.version() is "0.72.7".

I post this here because this seems specific to the GR backend and not a Plots issue - hope that is okay.

@jheinen
Copy link
Owner

jheinen commented May 30, 2023

Thanks for pointing this out. The problem is related to the hidden-line removal in the GR wireframe function. We will fix it ASAP.

@sebastiantk
Copy link
Author

Thank you!

@jheinen
Copy link
Owner

jheinen commented Jun 2, 2023

This issue is fixed in the master branch. A new release will be published next week.

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