Let me clarify my question:
plot.new()
polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5))
If the device is an on-screen device, can I check whether a particular area
has anything drawn on it, or, to be precise, whether the color of a
particular area has all pixels equal to the background color. That is, if
the background is white, can I know whether a particular area is white?
E.g., in the case above, the area bounded by rect(0, 0, .25, .25) is
completely white, while the area bounded by rect(0, 0, .75, .75) is not
because part of border of the polygon, black by default, has been drawn in
this area.
If the device is an image file, then I can check the color of a pixel. I
would like to know whether I can do the same with an on-screen device.
Thanks.
Regards,
Shu Fai
On Sun, Oct 15, 2023 at 11:44?PM Shu Fai Cheung <shufai.cheung at
gmail.com>
wrote:
> Sorry that I did not make my question clear enough.
>
> If the device is file based (e.g., a PNG file), then I believe I can do
> that, by using functions that can inspect an image. This is the solution I
> originally wanted to try. However, it requires creating a file in the
> process.
>
> I would like to see whether it is possible to inspect the canvas if the
> device is an on-screen one, like the pop-up window in R for Windows.
>
> Regards,
> Shu Fai
>
>
> On Sun, Oct 15, 2023 at 11:31?PM Jeff Newmiller <jdnewmil at
dcn.davis.ca.us>
> wrote:
>
>> This question is not clear to me. What is it you hope to retrieve from
>> the device?
>>
>> Note that the type of device in your example is system-dependent. The
>> content in a png() would be different than the content in a win.graph()
>> device.
>>
>> On October 15, 2023 8:04:00 AM PDT, Shu Fai Cheung <
>> shufai.cheung at gmail.com> wrote:
>> >Hi All,
>> >
>> >I want to inspect the content of a plot generated by another
function.
>> >
>> >For example:
>> >
>> >plot.new()
>> >polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5))
>> >
>> >A polygon will be drawn. If I do not know what has been done to
generate
>> >the plot, is it possible to query the content in the active device?
>> >
>> >Regards,
>> >Shu Fai
>> >
>> > [[alternative HTML version deleted]]
>> >
>> >______________________________________________
>> >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
see
>> >https://stat.ethz.ch/mailman/listinfo/r-help
>> >PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> >and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>
[[alternative HTML version deleted]]