pbs-software / pbs-mapping

R package PBSmapping - Mapping fisheries data and spatial analysis tools
11 stars 4 forks source link

Cannot add axis ticks or labels to sides 3 and 4 #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
MF:
After issuing plotMap(), I am unable to add ticks or
labels to axes 3 or 4 with function calls `axis(3)`
or `axis(4)`.
----------------------------------------------------
RH:
NB has an internal function called `.addAxis`, but
it only assumes that a user would ever want to label
the bottom and left axes. I've modified the code to
allow any combination of the four axes, and called
the function `mikeAxis` (attached r file).

Example:
source("mikeAxis.r")
data(nepacLL)
plotMap(nepacLL,xlim=c(-126,-122),ylim=c(48,51),plt=c(.075,.95,.075,.95),cex=1.2
,mgp=c(2,.5,0),col="moccasin")
mikeAxis(3:4,par()$usr[1:2],ylim=par()$usr[3:4],tckLab=TRUE,tck=.014,tckMinor=.0
07,cex=1.2,mgp=c(2,.5,0))

Note:
The following calls to par() in `.addAxis` are very
strange to me as repeated calls to `.addAxis`
sequentially reduce the value of `cex`.

par(cex = par()$cex * 0.8)
par(mai = mai)
par(mex = par()$cex)
----------------------------------------------------

Original issue reported on code.google.com by rowan.ha...@dfo-mpo.gc.ca on 13 Mar 2013 at 9:37

Attachments:

GoogleCodeExporter commented 9 years ago
RH: 
I've added a temporary function called `.addAxis2` in r50 that can add axes to 
any of the four sides of a map created by `plotMap`. At some point, this 
functionality should be incorporated into the original function `.addAxis`.

Other issues outstanding are:
(a) the iterative shrinking of par()$mex, and 
(b) the inability of the `axis` command to modify a map.

Original comment by rowan.ha...@dfo-mpo.gc.ca on 6 May 2013 at 7:10