how to visualize a map from a binary file in the b

2019-08-24 09:35发布

问题:

this code given bellow will read a binary file and simply visualize the map as shown bellow Here is a link to the file

firsrow <- file("C:\\LaiAverage_2011_WGS84_50km.img", "rb")
row1 = readBin(firsrow, integer(), size = 2, n = 720*360, signed = F)
y <- matrix(data = row1, ncol = 360, nrow = 720)
image(t(t(y)), ylim=c(1,0)).

can anyone help me to visualize it like this instead:

回答1:

Your question is quite broad and vague, therefore my answer will share those qualities. In addition, I will focus on a ggplot2 based solution.

  • To change the fill color, look at scale_fill_*, where * is e.g. continuous or gradient.
  • to change the layout of the x and y axis, look at scale_{x,y}_*, e.g. the labels and breaks arguments.
  • To get high-res output, either save as pdf or high res png. I greatly prefer using ggsave for this.


标签: r plot ggplot2