Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'PointSize' topicStudent Support Forum > General > Archives > "PointSize"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'PointSize')
Author Date Posted
PointSize MaxiWenz 06/25/12 09:52am
Re: PointSize Michael 06/25/12 6:05pm
Re: Re: PointSize MaxiWenz 06/28/12 03:36am
Re: Re: PointSize MaxiWenz 06/28/12 03:57am
Re: Re: Re: PointSize Michael 06/29/12 7:34pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic