Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f0ecd6

Browse files
committed
add quantile aes to regression lines
1 parent a97e2d5 commit 9f0ecd6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

_posts/ggplot2/2017-04-21-geom_quantile.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ p <- ggplot(df, aes(lwt, bwt, colour = smoke)) +
6262
geom_point(size = 1) +
6363
geom_quantile(quantiles = 0.5)
6464
65-
ggplotly(p)
65+
p <- ggplotly(p)
6666
6767
# Create a shareable link to your chart
6868
# Set up API credentials: https://plot.ly/r/getting-started
@@ -98,9 +98,9 @@ df <- with(df, {
9898
9999
p <- ggplot(df, aes(lwt, bwt, colour=smoke)) +
100100
geom_point(size = 1) +
101-
geom_quantile(quantiles = c(0.1, 0.5, 0.9), size = 2, alpha = 0.5)
102-
103-
ggplotly(p)
101+
geom_quantile(quantiles = c(0.1, 0.5, 0.9), size = 2, aes(alpha = ..quantile..)) +
102+
scale_alpha(range = c(0.3, 0.7))
103+
p <- ggplotly(p)
104104
105105
# Create a shareable link to your chart
106106
# Set up API credentials: https://plot.ly/r/getting-started

_posts/ggplot2/2017-04-21-geom_quantile.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ packageVersion('plotly')
3636
```
3737

3838
```
39-
## [1] '4.8.0.9000'
39+
## [1] '4.9.0.9000'
4040
```
4141

4242
### Basic Example
@@ -64,7 +64,7 @@ p <- ggplot(df, aes(lwt, bwt, colour = smoke)) +
6464
geom_point(size = 1) +
6565
geom_quantile(quantiles = 0.5)
6666

67-
ggplotly(p)
67+
p <- ggplotly(p)
6868

6969
# Create a shareable link to your chart
7070
# Set up API credentials: https://plot.ly/r/getting-started
@@ -99,9 +99,9 @@ df <- with(df, {
9999

100100
p <- ggplot(df, aes(lwt, bwt, colour=smoke)) +
101101
geom_point(size = 1) +
102-
geom_quantile(quantiles = c(0.1, 0.5, 0.9), size = 2, alpha = 0.5)
103-
104-
ggplotly(p)
102+
geom_quantile(quantiles = c(0.1, 0.5, 0.9), size = 2, aes(alpha = ..quantile..)) +
103+
scale_alpha(range = c(0.3, 0.7))
104+
p <- ggplotly(p)
105105

106106
# Create a shareable link to your chart
107107
# Set up API credentials: https://plot.ly/r/getting-started

0 commit comments

Comments
 (0)