반응형
R이 축약 된 축 레이블 플로팅을 중지하도록 강제합니다 (예 : ggplot2의 1e + 00).
ggplot2에서 축 레이블이 축약되는 것을 어떻게 막을 수 1e+00, 1e+01
있습니까? 예를 들어 일단 플로팅 된 x 축을 따라? 이상적으로는 R이 실제 값을 표시하도록 강제하고 싶습니다 1,10
.
많은 도움을 주셔서 감사합니다.
나는 당신이 이것을 찾고 있다고 생각합니다.
require(ggplot2)
df <- data.frame(x=seq(1, 1e9, length.out=100), y=sample(100))
# displays x-axis in scientific notation
p <- ggplot(data = df, aes(x=x, y=y)) + geom_line() + geom_point()
p
# displays as you require
require(scales)
p + scale_x_continuous(labels = comma)
다음과 같은 것을 시도 했습니까?
options(scipen=10000)
플로팅하기 전에?
@Arun이 만든 업데이트에 대한 업데이트입니다. 오늘 시도했지만 실제로 작동하지 않았기 때문에
+ scale_x_continuous(labels = scales::comma)
보다 일반적인 솔루션으로 scales::format_format
과학적 표기법을 제거하는 데 사용할 수 있습니다 . 또한 scales::comma
쉼표로만 구분하는 것과 달리 레이블을 정확히 표시 할 방법을 제어 할 수 있습니다 .
예를 들면 :
require(ggplot2)
require(scales)
df <- data.frame(x=seq(1, 1e9, length.out=100), y=sample(100))
# Here we define spaces as the big separator
point <- format_format(big.mark = " ", decimal.mark = ",", scientific = FALSE)
# Plot it
p <- ggplot(data = df, aes(x=x, y=y)) + geom_line() + geom_point()
p + scale_x_continuous(labels = point)
반응형
'developer tip' 카테고리의 다른 글
단어가 포함되지 않은 줄을 일치시키는 방법 (0) | 2020.10.10 |
---|---|
(1, eval) ( 'this') 대 eval ( 'this') JavaScript에서? (0) | 2020.10.10 |
Python- "OpenGL.error"로거에 대한 처리기를 찾을 수 없습니다. (0) | 2020.10.09 |
HTTP를 통해 원격 서버에서 이미지 복사 (0) | 2020.10.09 |
td 내부의 HTML 테이블 tr (0) | 2020.10.09 |