【发布时间】:2018-07-18 01:08:49
【问题描述】:
我正在为我的硕士论文使用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
【问题讨论】:
-
@eipi10 我在
plot_temp()中尝试了您的建议color.palette = heat.colors,但是我收到以下消息:In par(mai = mai, omi = omi, ps = ps, mgp = mgp, ...) : "color.palette" is not a graphical parameter -
我的 cmets 太长了,我决定将它们添加为答案。不幸的是,我无法测试其他选项,因为我无法让
plot_temp示例工作。我暂时保留我的答案,但如果结果不可行,我会删除它。 -
好吧,在通过
plot_temp调用的函数链之后,看起来filled.contour没有被调用。而是直接调用外部C函数.filled.contour(filled.contour也调用C函数),绕过filled.contour。所以看起来可能没有办法传递color.palette参数。我会删除我的答案。 -
还有一件事要尝试:看看
palette=heat.colors是否有效。 -
嗯,希望有人能提供一个可行的选项。如果做不到这一点,您可以查看
plot_temp的代码及其调用的函数,并对其进行调整以编写您自己的函数来绘制等高线图。
标签: r github plot color-palette par