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

Simple patch drawing #605

Open
StreetLevel opened this issue Dec 8, 2016 · 8 comments
Open

Simple patch drawing #605

StreetLevel opened this issue Dec 8, 2016 · 8 comments
Labels
extension new behaviour

Comments

@StreetLevel
Copy link

Hi,
sometimes it would be useful if one could draw 2D and 3D Matlab-like patch objects via Plots.jl:

patch

For me it would be useful for visualizing small finite element models in Julia without using a post processing tool but I think it's useful in many other cases too.
I think it's a basic feature for a plotting library and should be implemented in Plots.jl

Best, Max

@tbreloff
Copy link
Member

tbreloff commented Dec 8, 2016 via email

@StreetLevel
Copy link
Author

StreetLevel commented Dec 8, 2016

Ok thank you, I have to look into that.

Is it possible to interpolate nodal color data like this?

patch2

@tbreloff
Copy link
Member

tbreloff commented Jan 5, 2017

There's nothing like this built into Plots. I'm curious how you'd use this in practice (i.e. why is it useful?)

@RaulDurand
Copy link

I would find this useful in some numerical methods as for example in the Finite Element method where nodal interpolation is usually done to better visualize fields (as displacement, temperature, etc.)

@zaz1588
Copy link

zaz1588 commented May 3, 2017

I am migrating from MATLAB as well and visualizing data over an triangular mesh is paramount to my work. I made a small example that could showcase the usefulness of this. Using delaunay to create a triangular mesh over random points and and coloring each triangle with the Y position. I still did not manage to get a colorbar to show up. Any ideas? I tried to figure out how to use the seriestype = :shape tip but could not figure out how to use @recipes. To the best of my knowledge, there is no way to plot a triangular mesh in 3D. Doing that is quite straightforward with PyPlot or plotly and that is how I am doing those plots now but I would rather use Plots.

using VoronoiDelaunay
using Plots
##
N = 100
x = 1.0 + rand(N)
y = 1.0 + rand(N)
tess1 = DelaunayTessellation()
pts1 = [Point(x[n], y[n]) for n=1:N]
push!(tess1, pts1)
##
scatter(x, y,leg=false,palette=:heat)
for i in tess1
  t=Shape([geta(i)._x,getb(i)._x,getc(i)._x],[geta(i)._y,getb(i)._y,getc(i)._y])
  plot!(t,fill = (0, 0.5, RGB(geta(i)._y-1, geta(i)._y-1, geta(i)._y-1)))
end
gui()

newplot

@mkborregaard
Copy link
Member

see also the discussion here #392

@mkborregaard
Copy link
Member

Can't you do this with surface (or heatmap in @StreetLevel 's case above) while passing the area as a matrix, see e.g. #479 ?

@zaz1588
Copy link

zaz1588 commented Aug 8, 2017

#479 deals with regular grids. doesn't work with triangles.
#392 is basically the same as this.
Heatmap only works for regulars grids. doing it for unstructured triangulargrids is the issue here. as I tried to show in my example.

@t-bltg t-bltg added the extension new behaviour label Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension new behaviour
Projects
None yet
Development

No branches or pull requests

6 participants