r - ggplot 精确轴范围加反向
问题描述
与ggplot 精确轴范围几乎完全相同的问题,除了我还需要从上到下反转 y 轴。直接从上面表示
myData = data.frame(x = c(0, 1, 2, 3, 4, 5),
y = c(0.05,0.06, 0.07, 0.08, 0.09, 0.09))
ggplot() +
geom_step(data=myData, aes(x=x, y=y), color='blue', size=1) +
xlab('') +
ylab('') +
scale_x_continuous(expand = expand_scale(), limits = c(0,5))+
scale_y_continuous(labels = scales::percent, expand = expand_scale(), limits = c(0,0.12))
#adding reverse goes wrong
ggplot() +
geom_step(data=myData, aes(x=x, y=y), color='blue', size=1) +
xlab('') +
ylab('') +
scale_x_continuous(expand = expand_scale(), limits = c(0,5))+
scale_y_continuous(labels = scales::percent, expand = expand_scale(), limits = c(0,0.12), trans="reverse")
解决方案
推荐阅读
- sql - 从另一个表中的特定行更新多个列
- python - 过滤国家以应用不同的停用词
- c# - 物体不会停止移动。使用新的输入系统
- sql-server - 在 SQL Server 和 Postgres 中将 DateTime 转换为字符串
- c# - WPF C# - 如何将对象动态添加到 ListView?
- java - Hive Generic UDF:Hive 未按预期进行转换,原因是:java.lang.ClassCastException:java.util.ArrayList 无法转换为 java.util.Map
- symfony - Symfony 3 - 查询缺少标识符 id
- linux - 使用 ipmitool 通过串行局域网 (SOL) 使用 Linux kgdb
- python - 在 macos for python 上的 vscode 中安装 selenium 库
- opencv - Open CV capture read() 不读取特定视频帧 fps 59.9