| Author |
Comment/Response |
Michael
|
06/25/12 6:05pm
I don't think Mathematica easily does this sort of "clipping" to a region in Graphics[]. However, it can do it with Image[]. Try this:
Manipulate[
ImageAdd[
Image@Graphics[{(*Background color.*)
Background -> RGBColor[0.9, 0.9, 0.9],(*Color of the country.*)
RGBColor[0.4, 0.4, 0.4],(*Border of country whit polygon*)
CountryData["Spain",
"Polygon"],(*Coordinate of the point at {-3.71`,40.42`}.*)
Red, {PointSize[pointSize], Point[{-3.71`, 40.42`}]}},
PlotRangeClipping -> True],
Image@Graphics[{(*Border of country whit polygon*)
CountryData["Spain", "Polygon"]}]], {pointSize, 0, 1}]
By the way, the BackgroundColor option is in the wrong place. If you want a light gray background, here's one way
Manipulate[
ImageAdd[ImageMultiply[
Image@Graphics[{RGBColor[0.4, 0.4, 0.4],
CountryData["Spain", "Polygon"],
Red, {PointSize[pointSize], Point[{-3.71`, 40.42`}]}},
PlotRangeClipping -> True],
Image@Graphics[{GrayLevel[1], CountryData["Spain", "Polygon"]},
Background -> GrayLevel[0]]],
Image@Graphics[{GrayLevel[0], CountryData["Spain", "Polygon"]},
Background -> GrayLevel[0.9]]], {pointSize, 0, 1}]
URL: , |
|