8000 Merge pull request #22 from plotly/replace_p_fig · plotly/plotly.r-docs@51f28e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 51f28e4

Browse files
authored
Merge pull request #22 from plotly/replace_p_fig
replacing p with fig
2 parents cd4d65d + b9c1628 commit 51f28e4

File tree

134 files changed

+2227
-2060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+2227
-2060
lines changed

ggplot2/2011-11-29-scale-x.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ p <- ggplot(MySample, aes(date, y, fill = year)) +
4040
scale_x_date(labels = date_format("%b/%y")) +
4141
scale_fill_gradient(breaks=unique(MySample$year))
4242
43-
p <- ggplotly(p)
43+
fig <- ggplotly(p)
4444
45-
p
45+
fig
4646
```
4747
Inspired by <a href="http://stackoverflow.com/questions/11472856/month-year-bar-graph-plot-faceted-and-filled-on-year-with-data-input-as-date-in?rq=1">Stack Overflow</a>.
4848

@@ -72,8 +72,8 @@ p <- ggplot(data = df,
7272
facet_grid(facets = Year ~ .) +
7373
scale_x_date(labels = function(x) format(x, "%d-%b"))
7474
75-
p <- ggplotly(p)
75+
fig <- ggplotly(p)
7676
77-
p
77+
fig
7878
```
7979
Inspired by <a href="http://stackoverflow.com/questions/11472856/month-year-bar-graph-plot-faceted-and-filled-on-year-with-data-input-as-date-in?rq=1">Stack Overflow</a>.

ggplot2/2011-11-29-scale-y.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ p <- ggplot(diamonds, aes(color, log10(price))) +
2525
geom_boxplot() +
2626
scale_y_continuous("Price, log10-scaling")
2727
28-
p <- ggplotly(p)
28+
fig <- ggplotly(p)
2929
30-
p
30+
fig
3131
```
3232
Inspired by <a href="http://stackoverflow.com/questions/4699493/transform-only-one-axis-to-log10-scale-with-ggplot2">Stack Overflow</a>.

ggplot2/2016-11-29-aes.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ p <- ggplot(ds, aes(x, y)) +
2929
geom_bar(aes(fill = group), stat = "identity") +
3030
ggtitle("Filled bar chart")
3131
32-
p <- ggplotly(p)
32+
fig <- ggplotly(p)
3333
34-
p
34+
fig
3535
```
3636

3737
### Group
@@ -46,7 +46,7 @@ x3 <- x2 + 100
4646
x <- c(x1, x2, x3)
4747
y <- c(2*x1, 5*x2, -2*x3)
4848
49-
group <- c(rep("A", length(x1)),
49+
group <- c(rep("A", length(x1)),
5050
rep("B", length(x2)),
5151
rep("C", length(x3)))
5252
@@ -57,9 +57,9 @@ p <- ggplot(ds, aes(x, y)) +
5757
geom_line(aes(group = group, color = group), size = 2) +
5858
ggtitle("Group specific line chart")
5959
60-
p <- ggplotly(p)
60+
fig <- ggplotly(p)
6161
62-
p
62+
fig
6363
```
6464

6565
### Label
@@ -76,9 +76,9 @@ p <- ggplot(ds, aes(x, y)) +
7676
geom_text(aes(label = group), size = 4) +
7777
ggtitle("Annotation with labels")
7878
79-
p <- ggplotly(p)
79+
fig <- ggplotly(p)
8080
81-
p
81+
fig
8282
```
8383

8484
### Shape
@@ -96,9 +96,9 @@ p <- ggplot(ds, aes(x, y)) +
9696
geom_line(aes(group = group, linetype = group)) +
9797
ggtitle("Groupwise shapes and line types")
9898
99-
p <- ggplotly(p)
99+
fig <- ggplotly(p)
100100
101-
p
101+
fig
102102
```
103103

104104
Inspired by <a href="http://docs.ggplot2.org/current/">ggplot2 documentation</a>

ggplot2/2016-11-29-axis-text.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ p <- ggplot(df, aes(carat, price, color = color, alpha = cut)) +
2828
theme(axis.text.x = element_text(colour = "#ff6666", size = 20),
2929
axis.text.y = element_text(colour = "#668cff", size = 20))
3030
31-
p <- ggplotly(p)
31+
fig <- ggplotly(p)
3232
33-
p
33+
fig
3434
```
3535

3636
### Axis Text Blank
@@ -45,9 +45,9 @@ p <- ggplot(df, aes(carat, price, color = cut)) +
4545
geom_point() +
4646
theme(axis.text = element_blank())
4747
48-
p <- ggplotly(p)
48+
fig <- ggplotly(p)
4949
50-
p
50+
fig
5151
```
5252

5353
### Vertical Text
@@ -65,9 +65,9 @@ p <- ggplot(ds, aes(x = x, fill = y)) +
6565
theme(axis.text.x = element_text(angle = 90)) +
6666
ggtitle("Vertical Axis Labels")
6767
68-
p <- ggplotly(p)
68+
fig <- ggplotly(p)
6969
70-
p
70+
fig
7171
```
7272

7373
### Angled Text
@@ -85,8 +85,8 @@ p <- ggplot(ds, aes(x = x, fill = y)) +
8585
theme(axis.text.x = element_text(angle = 45)) +
8686
ggtitle("Angle Axis Labels")
8787
88-
p <- ggplotly(p)
88+
fig <- ggplotly(p)
8989
90-
p
90+
fig
9191
```
9292
Inspired by <a href="http://docs.ggplot2.org/current/">ggplot2 documentation</a>

ggplot2/2016-11-29-axis-ticks.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ p <- ggplot(df, aes(carat, price)) +
2727
geom_point() +
2828
theme(axis.ticks = element_line(size = 10))
2929
30-
p <- ggplotly(p)
30+
fig <- ggplotly(p)
3131
32-
p
32+
fig
3333
```
3434
Inspired by <a href="http://docs.ggplot2.org/current/">ggplot2 documentation</a>

ggplot2/2016-11-29-axis-title.Rmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ p <- ggplot(df, aes(carat, price)) +
2828
geom_point() +
2929
labs(title = "Diamonds", x = "x-axis -> Carat", y = "y-axis -> Price")
3030
31-
p <- ggplotly(p)
31+
fig <- ggplotly(p)
3232
3333
# Alternatively use
3434
p <- ggplot(df, aes(carat, price)) +
@@ -37,9 +37,9 @@ p <- ggplot(df, aes(carat, price)) +
3737
xlab("x-axis -> Carat") +
3838
ylab("y-axis -> Price")
3939
40-
p <- ggplotly(p)
40+
fig <- ggplotly(p)
4141
42-
p
42+
fig
4343
```
4444

4545
### Axis Title Size
@@ -57,9 +57,9 @@ p <- ggplot(df, aes(carat, price)) +
5757
axis.title.x = element_text(size = 20),
5858
axis.title.y = element_text(size = 20))
5959
60-
p <- ggplotly(p)
60+
fig <- ggplotly(p)
6161
62-
p
62+
fig
6363
```
6464

6565
### Axis Title Colors
@@ -77,8 +77,8 @@ p <- ggplot(df, aes(carat, price)) +
7777
axis.title.x = element_text(size = 20, colour = "#6699ff"),
7878
axis.title.y = element_text(size = 20, colour = "#ff8080"))
7979
80-
p <- ggplotly(p)
80+
fig <- ggplotly(p)
8181
82-
p
82+
fig
8383
```
8484
Inspired by <a href="http://docs.ggplot2.org/current/">ggplot2 documentation</a>

ggplot2/2016-11-29-facet-grid.Rmd

Lines changed: 14 additions & 14 deletions
10000
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ p <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
2727
# Divide by levels of "sex", in the vertical direction
2828
p <- p + facet_grid(sex ~ .)
2929
30-
p <- ggplotly(p)
30+
fig <- ggplotly(p)
3131
32-
p
32+
fig
3333
```
3434

3535
### Horizontal Grid
@@ -43,9 +43,9 @@ p <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
4343
# Divide by levels of "sex", in the horizontal direction
4444
p <- p + facet_grid(. ~ sex)
4545
46-
p <- ggplotly(p)
46+
fig <- ggplotly(p)
4747
48-
p
48+
fig
4949
```
5050

5151
### Free Scale
@@ -59,9 +59,9 @@ p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")
5959
# Histogram of total_bill, divided by sex and smoker
6060
p <- p + facet_grid(sex ~ smoker)
6161
62-
p <- ggplotly(p)
62+
fig <- ggplotly(p)
6363
64-
p
64+
fig
6565
```
6666

6767
### Free Y Axis
@@ -75,9 +75,9 @@ p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")
7575
# Same as above, with scales="free_y"
7676
p <- p + facet_grid(sex ~ smoker, scales="free_y")
7777
78-
p <- ggplotly(p)
78+
fig <- ggplotly(p)
7979
80-
p
80+
fig
8181
```
8282

8383
### Varied Range
@@ -91,9 +91,9 @@ p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")
9191
# With panels that have the same scaling, but different range (and therefore different physical sizes)
9292
p <- p + facet_grid(sex ~ smoker, scales="free", space="free")
9393
94-
p <- ggplotly(p)
94+
fig <- ggplotly(p)
9595
96-
p
96+
fig
9797
```
9898

9999
### Time Series Data
@@ -117,9 +117,9 @@ p <- ggplot(mymelt, aes(x = mydate, y = value)) +
117117
axis.ticks = element_blank(),
118118
panel.grid.minor = element_blank())
119119
120-
p <- ggplotly(p)
120+
fig <- ggplotly(p)
121121
122-
p
122+
fig
123123
```
124124

125125
### Geom Line
@@ -141,7 +141,7 @@ p <- ggplot(dat, aes(x=date, y=value, color=location, group=location)) +
141141
geom_line()+
142142
facet_grid(product ~ ., scale = "free_y")
143143
144-
p <- ggplotly(p)
144+
fig <- ggplotly(p)
145145
146-
p
146+
fig
147147
```

ggplot2/2016-11-29-facet-wrap.Rmd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ p <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
2626
# Divide by day, going horizontally and wrapping with 2 columns
2727
p <- p + facet_wrap( ~ day, ncol=2)
2828
29-
p <- ggplotly(p)
29+
fig <- ggplotly(p)
3030
31-
p
31+
fig
3232
```
3333
Inspired by <a href="http://www.cookbook-r.com/Graphs/Scatterplots_(ggplot2)/">Cookbook for R</a>
3434

@@ -51,9 +51,9 @@ tolerance <- within(tolerance, {
5151
p <- ggplot(data = tolerance, aes(x = time, y = tolerance)) + geom_point() +
5252
stat_smooth(method = "lm", se = FALSE) + facet_wrap(~id)
5353
54-
p <- ggplotly(p)
54+
fig <- ggplotly(p)
5555
56-
p
56+
fig
5757
```
5858
Inspired by <a href="http://www.ats.ucla.edu/stat/r/faq/growth.htm">The IDRE at UCLA</a>
5959

@@ -67,9 +67,9 @@ p <- ggplot(mpg, aes(displ, hwy))+
6767
stat_smooth()+
6868
facet_wrap(~year)
6969
70-
p <- ggplotly(p)
70+
fig <- ggplotly(p)
7171
72-
p
72+
fig
7373
```
7474
Inspired by <a href="http://www.ling.upenn.edu/~joseff/rstudy/summer2010_ggplot2_intro.html">R Study Group</a>
7575

@@ -89,9 +89,9 @@ p <- ggplot(df, aes(carat, price)) +
8989
geom_point() +
9090
facet_wrap(~ clarity)
9191
92-
p <- ggplotly(p)
92+
fig <- ggplotly(p)
9393
94-
p
94+
fig
9595
```
9696
Inspired by <a href="http://stackoverflow.com/questions/3472980/ggplot-how-to-change-facet-labels">Stack Overflow</a>
9797

@@ -112,9 +112,9 @@ p <- ggplot(df, aes(carat, price)) +
112112
facet_wrap(~ clarity) +
113113
ggtitle("Diamonds dataset facetted by clarity")
114114
115-
p <- ggplotly(p)
115+
fig <- ggplotly(p)
116116
117-
p
117+
fig
118118
```
119119
Inspired by <a href="http://docs.ggplot2.org/current/">ggplot2 Documentation</a>
120120

@@ -135,8 +135,8 @@ p <- ggplot(df, aes(carat, price)) +
135135
facet_wrap(~ clarity) +
136136
ggtitle("Diamonds dataset facetted by clarity")
137137
138-
p <- ggplotly(p)
138+
fig <- ggplotly(p)
139139
140-
p
140+
fig
141141
```
142142
Inspired by <a href="http://stackoverflow.com/questions/3311901/how-do-i-get-ggplot-to-order-facets-correctly">Stack Overflow</a>

0 commit comments

Comments
 (0)
0