# NOT RUN {
#Example 1: add color to points
MyPoints=create_Points(PointData)
MyCols=add_col(MyPoints$Nfishes) #With default cols and cuts
plot(MyPoints,pch=21,bg=MyCols$varcol,cex=2)
MyCols=add_col(MyPoints$Nfishes,cols=c('blue','red')) #With custom colors - here from blue to red
plot(MyPoints,pch=21,bg=MyCols$varcol,cex=2)
MyCols=add_col(MyPoints$Nfishes,cols=c('blue','red'),cuts=3) #With custom colors and fewer classes
plot(MyPoints,pch=21,bg=MyCols$varcol,cex=2)
#Example 2: add color to a grid, using custom cuts and colors, and adding a color scale (add_Cscale)
#Step 1: Generate your grid
MyGrid=create_PolyGrids(GridData,dlon=2,dlat=1)
#Step 2: Inspect your grid data (e.g. sum of Catch) to determine whether irregular cuts are required
hist(MyGrid$Catch_sum,100)
#In this case (heterogeneously distributed data) irregular cuts would be preferable
#Step 3: Generate colors according to the desired classes (cuts)
Gridcol=add_col(MyGrid$Catch_sum,cuts=c(0,50,100,500,2000,3500),cols=c('yellow','purple'))
#Step 4: Plot result and add color scale
Mypar=par(mai=c(0,0,0,2)) #Figure margins as c(bottom, left, top, right)
plot(MyGrid,col=Gridcol$varcol) #Use the colors generated by add_col
#Add color scale using cuts and cols generated by add_col
add_Cscale(title='Sum of Catch (t)',cuts=Gridcol$cuts,cols=Gridcol$cols,width=33)
par(Mypar)
# }
Run the code above in your browser using DataLab