Skip to content

Commit ddd9257

Browse files
committed
Merge branch 'master' of github.com:ropensci/plotly into add-r-cookbook-tests
2 parents 6f75003 + 51a2b91 commit ddd9257

10 files changed

+158
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: plotly
22
Type: Package
33
Title: Interactive, publication-quality graphs online.
4-
Version: 0.5.1
4+
Version: 0.5.2
55
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cre"),
66
email = "[email protected]"),
77
person("Scott", "Chamberlain", role = "aut",

R/ggplotly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ markLegends <-
4141
## Legends based on sizes not implemented yet in Plotly
4242
## list(point=c("colour", "fill", "shape", "size"),
4343
list(point=c("colour", "fill", "shape"),
44-
path=c("linetype", "size", "colour"),
44+
path=c("linetype", "size", "colour", "shape"),
4545
polygon=c("colour", "fill", "linetype", "size", "group"),
4646
bar=c("colour", "fill"),
4747
step=c("linetype", "size", "colour"),
Loading
Loading
Loading
Loading
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"data": [
3+
{
4+
"x": [
5+
"Lunch",
6+
"Dinner"
7+
],
8+
"y": [
9+
13.53,
10+
16.81
11+
],
12+
"mode": "lines",
13+
"name": "Female",
14+
"line": {
15+
"color": "rgb(0,0,0)",
16+
"width": 2,
17+
"dash": "solid",
18+
"shape": "linear"
19+
},
20+
"xaxis": "x1",
21+
"yaxis": "y1",
22+
"type": "scatter"
23+
},
24+
{
25+
"x": [
26+
"Lunch",
27+
"Dinner"
28+
],
29+
"y": [
30+
16.24,
31+
17.42
32+
],
33+
"mode": "lines",
34+
"name": "Male",
35+
"line": {
36+
"color": "rgb(0,0,0)",
37+
"width": 2,
38+
"dash": "solid",
39+
"shape": "linear"
40+
},
41+
"xaxis": "x1",
42+
"yaxis": "y1",
43+
"type": "scatter"
44+
},
45+
{
46+
"x": [
47+
"Lunch",
48+
"Dinner"
49+
],
50+
"y": [
51+
13.53,
52+
16.81
53+
],
54+
"mode": "markers",
55+
"name": "Female",
56+
"marker": {
57+
"color": "rgb(0,0,0)",
58+
"size": 10,
59+
"symbol": "circle",
60+
"opacity": 1,
61+
"sizeref": 1,
62+
"sizemode": "area"
63+
},
64+
"xaxis": "x1",
65+
"yaxis": "y1",
66+
"type": "scatter"
67+
},
68+
{
69+
"x": [
70+
"Lunch",
71+
"Dinner"
72+
],
73+
"y": [
74+
16.24,
75+
17.42
76+
],
77+
"mode": "markers",
78+
"name": "Male",
79+
"marker": {
80+
"color": "rgb(0,0,0)",
81+
"size": 10,
82+
"symbol": "triangle-up",
83+
"opacity": 1,
84+
"sizeref": 1,
85+
"sizemode": "area"
86+
},
87+
"xaxis": "x1",
88+
"yaxis": "y1",
89+
"type": "scatter"
90+
}
91+
],
92+
"layout": {
93+
"titlefont": {
94+
"family": ""
95+
},
96+
"showlegend": true,
97+
"xaxis": {
98+
"title": "time",
99+
"type": "category",
100+
"showgrid": true,
101+
"zeroline": false,
102+
"showline": false,
103+
"ticks": "outside",
104+
"showticklabels": true,
105+
"tickcolor": "rgb(127,127,127)",
106+
"gridcolor": "rgb(255,255,255)"
107+
},
108+
"yaxis": {
109+
"title": "total_bill",
110+
"type": "linear",
111+
"showgrid": true,
112+
"zeroline": false,
113+
"showline": false,
114+
"ticks": "outside",
115+
"showticklabels": true,
116+
"tickcolor": "rgb(127,127,127)",
117+
"gridcolor": "rgb(255,255,255)"
118+
},
119+
"legend": {
120+
"x": 100,
121+
"y": 0.5,
122+
"font": {
123+
"family": ""
124+
},
125+
"bgcolor": "rgb(255,255,255)",
126+
"bordercolor": "transparent"
127+
},
128+
"margin": {
129+
"r": 10
130+
},
131+
"paper_bgcolor": "rgb(255,255,255)",
132+
"plot_bgcolor": "rgb(229,229,229)"
133+
}
134+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://plot.ly/~TestBot/718
Loading

tests/testthat/test-ggplot-path.R

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,24 @@ test_that("paths with the same color but different groups stay together", {
6363

6464
save_outputs(gg, "path-colored-groups-stay-together")
6565
})
66+
67+
test_that("lines work with aesthetic shape", {
68+
df1 <- data.frame(sex = factor(c("Female", "Female", "Male", "Male")),
69+
time = factor(c("Lunch", "Dinner", "Lunch", "Dinner"),
70+
levels=c("Lunch", "Dinner")),
71+
total_bill = c(13.53, 16.81, 16.24, 17.42))
72+
gg <- ggplot(data=df1, aes(x=time, y=total_bill, group=sex, shape=sex)) +
73+
geom_line() +
74+
geom_point()
75+
info <- gg2list(gg)
76+
expect_equal(length(info), 5) # 2 lines and 2 sets of points for each group
77+
expect_identical(info[[3]]$name, "Female")
78+
expect_identical(info[[3]]$marker$symbol, "circle")
79+
expect_identical(info[[4]]$name, "Male")
80+
expect_identical(info[[4]]$marker$symbol, "triangle-up")
81+
# Layout
82+
expect_identical(info[[5]]$layout$xaxis$title, "time")
83+
expect_identical(info[[5]]$layout$xaxis$type, "category")
84+
85+
save_outputs(gg, "path-line-symbols")
86+
})

0 commit comments

Comments
 (0)