1

I am using "hydrogeo" package in R for piper plots. I want to make some edits in the function for customization of plots.

However, when I use following command

trace("hydrogeo", edit=TRUE)

I get following error

Error in getFunction(what, where = whereF) : no function ‘hydrogeo’ found

I tried editing other functions using the same command and it worked, e.g.,

trace("semiMarkov", edit=TRUE)

How to resolve this error?

dsbisht
  • 1,025
  • 4
  • 13
  • 24
  • I'm not familiar with that function specifically, but is there any reason why you can't just write a wrapper around the function? – camille Jan 31 '20 at 13:00
  • I have no idea what a wrapper is. – dsbisht Feb 01 '20 at 11:38
  • 2
    Like rather than editing the function itself, writing a function that calls *that* function with whatever arguments you want to customize. https://en.wikipedia.org/wiki/Wrapper_function But if the issue is just that this function isn't actually in the package, then it's a typo/non-reproducible – camille Feb 02 '20 at 14:36

1 Answers1

2

As stated in the error message hydrogeo is not a function of the hydrogeo package.

The available functions are:

library(hydrogeo)
ls("package:hydrogeo")
[1] "piper"      "piperPaper" "plot"       "testData"   "toPercent" 

For example calling:

trace("piperPaper", edit=TRUE)

returns:

function (size = NULL, ...) 
{
  new("piperplot", call = sys.call(), ...)
}

EDIT: DIAGRAM CUSTOMIZATION

By reading the documentation there are some parameters that can be used to customize size, symbols and color. They are respectively: cex, pt.pch and pt.col.

From the example below

library(hydrogeo)

l <- list( Ca = c(43,10,73,26,32),
           Mg = c(30,50,3,14,12),
           Cl = c(24,10,12,30,43),
           SO4 = c(24,10,12,30,43))

lp <- piper(l)
plot( lp, main="Piper-Hill Diagram of Water Quality" )

we obtain the diagram

base_diagram

  • by changing the cex parameter we obtain bigger symbols

    plot( lp, main="Piper-Hill Diagram of Water Quality", cex=4)

big_diagram

  • by changing the pt.pch parameter we can choose other symbols. The available symbols are

symbols

So with the statement:

lp@pt.pch = c(4,4,4,4,4)

We obtain enter image description here

  • by changing the pt.col parameter we can set the colors

    lp@pt.col = c(2,2,2,2,2)

symb_col_diagram

Alessio
  • 910
  • 7
  • 16
  • In this particular package I want to customize the plots bu changing line type, and polygon color. However, while calling any of the package in `trace("PACKAGE", edit=TRUE)`, I do not get the specific line of code where I can make the edits. Is there any way to edit specific lines of the package. – dsbisht Feb 03 '20 at 05:00
  • 1
    answered directly in the thread to add diagrams. Give it a check ;) – Alessio Feb 03 '20 at 11:16
  • I appreciate your effort however, here, I require to change the line type, reduce the line width, increase the number of grid lines, and increase the size of tick labels on axis. – dsbisht Feb 03 '20 at 11:25
  • I see.. For those customizations I guess you should talk to the package developer. From CRAN I found this contact: Myles English myles at rockhead.biz. – Alessio Feb 03 '20 at 14:17