在ggplot中设置轴间隔

A.K*_*ger 4 graphing visualization r ggplot2

我搜索过这个,不敢相信我找不到它.也许我一直在问错误的问题.

我有一组直方图中的数据,xlim为$ 2,000,000.我想设置休息时间(而不是手工列出了与每一个断裂的$ 100,000间隔break = c(0, 50000, 100000, etc),我怎么能在ggplot做到这一点呢?符(蜱)比标签更重要,因为我很可能会在Illustrator的编辑缩写标签(100k等)

p <- ggplot(mcsim, aes(result))
+ scale_x_continuous(formatter = "dollar") 
+ geom_histogram(aes(y = (..count..)/sum(..count..))) + scale_y_continuous(formatter = 'percent')
Run Code Online (Sandbox Code Playgroud)

谢谢!

在此输入图像描述

Bri*_*ggs 9

你可以用breaks=seq(0, 2000000, by=100000).实际上,您正在使用seq生成您不想手动输入的向量.