[R-sig-Geo] How to move legend of rhohat (spatstat)?

Rolf Turner r.turner at auckland.ac.nz
Sun May 13 10:41:57 CEST 2012


On 13/05/12 20:07, Yury Ryabov wrote:
> Hi,
>
> A "rhohat" function (in "spatstat" package) has its own built-in legend
> that appears at the top left corner of the graph. Seems that it is not
> affected by "par(legend())" or I don't have a clue how to write the
> corresponding statement. Help on "rhohat" does not provide informations
> about options to control the legend. Does any one know how to move this
> legend across the graph or at least how to make its fill transparent (this
> legend blocks an important part of my graph)?

An object returned by rhohat() is of class "rhohat" and so is plotted
by the method plot.rhohat() which in turn calls upon plot.fv().

If you look at the help for plot.fv() you will see that this takes
arguments "legendpos" and "legendargs" which should allow
you to accomplish what you want.

You can also set "legend=FALSE" in the call to plot(), which will
suppress the legend completely (if it's getting in your way and
annoying you).  And you could then add your own ad hoc legend
in any manner you please by calling the legend() function
directly.

I guess that you can make the background of the legend transparent
by doing

     plot(object,legendargs=list(bg="transparent"))

(where "object" is what is returned by rhohat()) but on my system at least
the background is transparent by default, so this seems unnecessary
to me.

HTH

     cheers,

         Rolf Turner



More information about the R-sig-Geo mailing list