Message Boards Message Boards

0
|
3543 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Jagged edges in ListDensityPlot[ ] output?

Posted 2 years ago

I'm trying to create a ListDensityPlot of a limb-darkened star using the Table function. I have had success in that (I can create a reasonable star if I add more points) but I noticed that points outside of the surface of the star also contain nonzero values (look at the Matrixform[s]) that create problems with what I'm trying to do. Is there an If statement that can be used to set any points where sqrt(x^2+y^2)>rstar to zero? Any help would be greatly appreciated! Below is the code at present:

POSTED BY: sorabella91
3 Replies
Posted 2 years ago

The points outside the radius are complex and are ignored by ListDensityPlot. From the documentation

holes will be left in the plot whenever there are elements that are not real numbers

The jagged edges are caused by not having enough points. Try pts = 200.

You can replace the complex values with 0 like this, but that does not do what you want because the color function is applied to those values.

sReal = Replace[S, _Complex -> 0, 2]
POSTED BY: Rohit Namjoshi
Posted 2 years ago

This actually does exactly what I'm looking for! While the values are applied to the colorfunction, it's really the Table itself that will be more useful for future calculations I plan on doing (the listdensityplot was a cool bonus feature). Yes I didn't use as many points just so the run time isn't excessively long for anyone wanting to see what the matrix looked like (pts 200 definitely looks great though I may actually need more for what I'm going to use this for)! Thank you very much for the help!

POSTED BY: sorabella91

I get rounded edges also with RegionFunction:

ListDensityPlot[S, ColorFunction -> "SolarColors", 
 DataRange -> rstar {{-1, 1}, {-1, 1}},
 RegionFunction -> Function[{x, y, z}, Norm[{x, y}] < .95 rstar]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract