[R] Change legend in the 'hydrogeo' package

From: Tomas Lanczos <lanczos_at_fns.uniba.sk>
Date: Tue, 08 Jul 2008 13:07:57 +0200

At first sorry for the possibly dumb question of a newbie.

I am using the hydrogeo package to visualize approx. 300 data within the Piper-Hill diagrams. The package is using a dataframe with 6 columns, first of them is containing the row.names, next four with the data itself. The last column contains "WaterTypes" dividing data to several categories. The diagram is created by the piper function, assigning different symbols following the row.names (I don't need id, however I can assign one symbol for the whole dataset using pch ) and assigmning colours following WaterTypes. Untill now it's working very well, what I need however is to change the legend, as it is showing all the 300 rows, even I assigned only one symbol. For me it is more appropriate to show the categories from the "WaterTypes" columns assigned to the colours.

Could somebody give me a hint how to change the code to give me an appropriate result? The answer is probably in the help assigned to the "legend" of the graphics package, but it's quite unclear to me.

Many thanks in advance


The piece of code from the hydrogeo package creating the legend is here:

  ylegend <- X

     plotlegend <- function(dd, X, ...) {
         xid <- c(X + p)
         yid <- c(ylegend - (X/30) * 1:nrow(dd))
         text(xid, yid, labels = row.names(dd), vfont = c("serif",
             "plain"), cex = 0.7)
         if (is.character(dd$pch)) {
             text(xid - (X/15), yid, labels = c(1:nrow(dd)), vfont = 
                 "plain"), cex = 0.7)

else { points(rep(xid - (X/15), length(yid)), yid, pch = dd$pch, col = dd$col)
return(min(yid)) } ______________________________________________
R-help_at_r-project.org mailing list
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. Received on Tue 08 Jul 2008 - 11:11:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Jul 2008 - 11:31:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive