1

我正在使用带有 gWidgets2RGtk2 库的 ggplot2 绘制数据。数据具有使用单位库设置的单位。通过使用库 ggforce,它会自动将单位放在绘图的轴标签中。

问题是如果数据的单位是 psi(磅每平方英寸),它会显示希腊字母 psi“Ψ”。我希望它显示“psi”。

我不确定问题出在单位、ggplot 还是 ggforce 中。

print(as.character(units(example_data$pressure)))

给出“psi”。

library(data.table)
library(units)
library(ggforce)

example_data <- data.table(time = 1:3, pressure = c(5, 10, 20))
units(example_data$time) <- ud_units$s
units(example_data$pressure) <- ud_units$psi
p <- ggplot(data = example_data, mapping = aes(time, pressure)) + geom_line()
print(p)
print(as.character(units(example_data$pressure)))
4

0 回答 0