在 R 中对齐网格线,bReeze 包
Aligning grid lines in R, bReeze package
我正在尝试让下图中的网格线正常工作。使用 bReeze
包绘制涡轮机的功率曲线:
library(bReeze)
pc=pc("Vestas_V90_1.8MW.wtg")
plot(pc)
输出图为:
但在以下帮助下将网格线分配给绘图:
grid()
给出下图:
关于如何修复扭曲的网格线有什么建议吗?
如果您不提供一些参数(例如 mar、xlim、ylim),
plot(pc)
使用 par(mar = c(5, 5, 1, 5)
并将 data.ranges 视为 xlim
和 ylim
。通过使用这些属性,您可以使用 grid()
.
pc.data = pc("Vestas_V90_1.8MW.wtg")
plot(pc.data)
par(mar = c(5, 5, 1, 5), new=T) # set par() and order to overlay
plot(pc.data[[1]], pc.data[[2]], type="n", ann=F, axes=F) # nothing but setting xy-cordinates
grid(NULL) # here, the same xy-coordinates are reproduced
# If you want to adjust grid lines to right y-axis, use berow code
:
par(mar = c(5, 5, 1, 5), new=T) # plot(pc) uses right ylim=c(0,1)
plot(pc.data[[1]], pc.data[[2]], ylim=c(0,1), type="n", ann=F, axes=F)
grid(NULL) # the xy(right)-coordinates are reproduced
# If you plot pc.object having single y-axis, use mar = c(5, 5, 1, 1)
我正在尝试让下图中的网格线正常工作。使用 bReeze
包绘制涡轮机的功率曲线:
library(bReeze)
pc=pc("Vestas_V90_1.8MW.wtg")
plot(pc)
输出图为:
但在以下帮助下将网格线分配给绘图:
grid()
给出下图:
关于如何修复扭曲的网格线有什么建议吗?
如果您不提供一些参数(例如 mar、xlim、ylim),
plot(pc)
使用 par(mar = c(5, 5, 1, 5)
并将 data.ranges 视为 xlim
和 ylim
。通过使用这些属性,您可以使用 grid()
.
pc.data = pc("Vestas_V90_1.8MW.wtg")
plot(pc.data)
par(mar = c(5, 5, 1, 5), new=T) # set par() and order to overlay
plot(pc.data[[1]], pc.data[[2]], type="n", ann=F, axes=F) # nothing but setting xy-cordinates
grid(NULL) # here, the same xy-coordinates are reproduced
# If you want to adjust grid lines to right y-axis, use berow code
:
par(mar = c(5, 5, 1, 5), new=T) # plot(pc) uses right ylim=c(0,1)
plot(pc.data[[1]], pc.data[[2]], ylim=c(0,1), type="n", ann=F, axes=F)
grid(NULL) # the xy(right)-coordinates are reproduced
# If you plot pc.object having single y-axis, use mar = c(5, 5, 1, 1)