-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Add :mesh3d
seriesstyle for PyPlot backend
#3835
Conversation
via `Poly3DCollection`.
I'm wondering if we can unify all backends on the Line 1184 in 5a48002
BTW, could you add the Please also update the Line 1238 in 4d40bae
for the docs. Otherwise LGTM at first glance. |
Codecov Report
@@ Coverage Diff @@
## master #3835 +/- ##
==========================================
- Coverage 63.50% 63.25% -0.26%
==========================================
Files 28 28
Lines 7464 7489 +25
==========================================
- Hits 4740 4737 -3
- Misses 2724 2752 +28
Continue to review full report at Codecov.
|
for the backends which support `:mesh3d` as series type.
Thanks for the feedback. I removed Hmm, I could add a method for |
Okay, I did not add a new method but added the support of the current (only-triangle) syntax for The example from the docs https://docs.juliaplots.org/latest/generated/plotlyjs/#plotlyjs-ref47 x = [0, 1, 2, 0]
y = [0, 0, 1, 2]
z = [0, 2, 0, 1]
i = [0, 0, 0, 1]
j = [1, 2, 3, 2]
k = [2, 3, 1, 3]
mesh3d(x, y, z; connections = (i, j, k),
title = "triangles", xlabel = "x", ylabel = "y", zlabel = "z",
legend = :none, margin = 2 * Plots.mm, alpha = 0.2) I am not fan of that syntax though as it uses 0-based indexing... |
Yep, I don't know who chose this (one argument maybe is that most meshing libraries are written in C/C++/Python, hence the It bothers me a little to have If it were me, I'd vote to unify this to |
Sorry for the force push. I forgot to delete one debugging line in the first place. |
No worries, I also use (and certainly abuse) the force push 😆 . |
I would also vote for As this would be a breaking change we could leave the |
This looks reasonable, but it'd be better if we had complementary opinions on this matter. |
|
I would really suggest to use the As Julia supports the definition of Array types which are But I am open to implement it in any way. Just tell my :) |
I am okay with this. There is no need for users to wrap their coordinate vectors though, we can do the neccessary +/-1 internally. |
Okay, I added the I also updated the example
|
I've modified your post, could you tick which backends you have tested ? (GR is automagically tested in the CI). |
I changed the system and was able to test all (comparing the plots produced by the two different syntax) successfully. |
Thanks a lot. I would appreciate, if you can have a look into #3503 to see, if your information is correct. |
Hi, great work! I have seen this with the update to 1.22.2 . Is there a way to do Gouraud shading based on a vector of point colors or a colormap ? Can triangle colors be specified ? I am asking specifically for the GR backend, because it's fast, and OpenGL supports all this. |
Not yet (it was evoked when I wrote #3612), but it shouldn't be too hard to implement if GR supports this ... |
I am actually in contact with Josef Heinen (GR.jl) regarding face colors. I hope we can add this soon. |
As I said, two modi would be interesting: node-wise coloring with color interpolation (Gouraud shading) With this functionality I could complete the Plots backend for GridVisualize.jl... |
I will communicate it to him. BTW, for the PyPlot backend we could maybe also add some shading option which I found for |
See also here: https://github.com/j-fu/GridVisualize.jl/blob/main/src/pyplot.jl#L497 OTOH pyplot is a bit overloaded performance-wise for this purpose, and the visual quality of the plots not that good (of course I could have missed some tricks here..). |
I added the support for the seriestype
:mesh3d
for the PyPlot backend.The inputs are the vertices of a mesh and the connections have to be specified via the
connections
keywordsimilar to https://docs.juliaplots.org/latest/generated/plotlyjs/#plotlyjs-ref47.
However, there is a difference in the syntax of how the connections are specified.
Here, it takes
::Vector{Vector{Ints}}
where each element of the outer vector defines a single polygon.Combinations of different polygons are possible as it is shown in the following example:
I hope I did everything correct and please let me know if something should be implemented in a different way.