# NOT RUN {
#Example 1: Simple grid, using automatic colors
MyGrid=create_PolyGrids(Input=GridData,dlon=2,dlat=1)
#View(MyGrid@data)
plot(MyGrid,col=MyGrid$Col_Catch_sum)
#Example 2: Equal area grid, using automatic colors
MyGrid=create_PolyGrids(Input=GridData,Area=10000)
plot(MyGrid,col=MyGrid$Col_Catch_sum)
#Example 3: Equal area grid, using custom cuts and colors
MyGrid=create_PolyGrids(Input=GridData,
Area=10000,cuts=c(0,50,100,500,2000,3500),cols=c('blue','red'))
plot(MyGrid,col=MyGrid$Col_Catch_sum)
#Example 4: Equal area grid, using custom cuts and colors, and adding a color scale (add_Cscale)
#Step 1: Generate your grid
MyGrid=create_PolyGrids(Input=GridData,Area=10000)
#Step 2: Inspect your gridded 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=24)
par(Mypar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab