0
|
2949 Views
|
3 Replies
|
3 Total Likes
View groups...
Share

# Contour calculations and RegionFunction

Posted 10 years ago
 When a ContourPlot is restricted to a region, the contour levels are still being calculated based on data values from the entire rectangular field. I think it would be more useful if they were calculated from data values as restricted by the specified RegionFunction.The attached notebook is an example. x^3 + y^3 is plotted over the unit square, with the region restricted to an enclosed disk. But contours are clearly calculated from the unrestricted data. This is of course a simple example of another data set I'm working with.  Attachments:
3 Replies
Sort By:
Posted 10 years ago
 Yes! Very nice, Marco. Thanks.
Posted 10 years ago
 Hi, in the Cloud (and probably in MMA 10 ?) this will work as well: f[x_, y_] := x^4 + y^4; R = ImplicitRegion[x^2 + y^2 < 0.5^2, {x, y}]; and then ContourPlot[f[x, y], {x, y} \[Element] R , Contours -> (FindDivisions[{#1, #2}, 10] &), ColorFunction -> "Rainbow"] I suppose that it is actually useful to have the two options for plotting. The RegionFunction does not change the colours and with ImplicitRegion you can actually restrict your calculation to the domain you are interested in. M.
Posted 10 years ago
 This In:= Plot[f[x, y], {x, -1, 1}, {y, -1, 1},RegionFunction -> Function[{x, y}, x^2 + y^2 <= (1/2)^2], Contours -> Range[1/32 - 0.025, 1/32, 0.005 ], PlotRange -> {{-3/5, 3/5}, {-3/5, 3/5}}] will do it because of In:= f[x, x] /. Last[Solve[2 x^2 == (1/2)^2, x, Reals]] Out= 1/32 because of the symmetry coincidence. Attachments: