[英]How to change the color palette of a plot using R and par() command?
我正在為我的碩士論文使用glmtools
庫,但是,默認的調色板在美學上並不令人滿意。 glmtools::plot_temp
幫助中沒有關於調色板的參數,只說其他參數傳遞給par()
。 我嘗試過更改調色板但沒有成功。 有什么幫助嗎?
安裝glmtools
devtools
devtools
devtools::install_github("GLEON/GLMr")
devtools::install_github("USGS-R/glmtools")
library(glmtools)
默認示例是:
sim_folder <- run_example_sim(verbose = FALSE)
nc_file <- file.path(sim_folder, 'output.nc')
plot_temp(file = nc_file, fig_path = FALSE)
plot_temp(file = nc_file, fig_path = 'test_figure.png', height = 3, reference = 'surface')
而可怕的結果是:
我想使用調色板terrain.colors
或heat.colors
使用glmtools
,我們有一些內部功能可以通過替代調色板,但還沒有在繪圖函數中公開它。 在github (0.14.8)上查看最新版本。 從可用於繪制溫度的plot_var
,您可以傳入您自己的調色板函數。 這應該適用於您通過glmtools
包以熱圖形式繪制的任何變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.