Skip to content

Commit 84a9cd8

Browse files
committed
Run image test for alpha fill
1 parent 18709da commit 84a9cd8

6 files changed

+280
-1
lines changed

run_tests_with_outputs.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
library(testthat)
2-
devtools::install_github("ropensci/plotly", ref="marianne-datetime-binning")
2+
devtools::install_github("ropensci/plotly", ref="marianne-area-colour")
33
library(plotly)
44

55
setwd("tests")
Loading
Loading
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
{
2+
"data": [
3+
{
4+
"x": [
5+
1875,
6+
1875,
7+
1876,
8+
1877,
9+
1878,
10+
1879,
11+
1880,
12+
1881,
13+
1882,
14+
1883,
15+
1884,
16+
1885,
17+
1886,
18+
1887,
19+
1888,
20+
1889,
21+
1890,
22+
1891,
23+
1892,
24+
1893,
25+
1894,
26+
1895,
27+
1896,
28+
1897,
29+
1898,
30+
1899,
31+
1900,
32+
1901,
33+
1902,
34+
1903,
35+
1904,
36+
1905,
37+
1906,
38+
1907,
39+
1908,
40+
1909,
41+
1910,
42+
1911,
43+
1912,
44+
1913,
45+
1914,
46+
1915,
47+
1916,
48+
1917,
49+
1918,
50+
1919,
51+
1920,
52+
1921,
53+
1922,
54+
1923,
55+
1924,
56+
1925,
57+
1926,
58+
1927,
59+
1928,
60+
1929,
61+
1930,
62+
1931,
63+
1932,
64+
1933,
65+
1934,
66+
1935,
67+
1936,
68+
1937,
69+
1938,
70+
1939,
71+
1940,
72+
1941,
73+
1942,
74+
1943,
75+
1944,
76+
1945,
77+
1946,
78+
1947,
79+
1948,
80+
1949,
81+
1950,
82+
1951,
83+
1952,
84+
1953,
85+
1954,
86+
1955,
87+
1956,
88+
1957,
89+
1958,
90+
1959,
91+
1960,
92+
1961,
93+
1962,
94+
1963,
95+
1964,
96+
1965,
97+
1966,
98+
1967,
99+
1968,
100+
1969,
101+
1970,
102+
1971,
103+
1972,
104+
1972
105+
],
106+
"y": [
107+
0,
108+
580.38,
109+
581.86,
110+
580.97,
111+
580.8,
112+
579.79,
113+
580.39,
114+
580.42,
115+
580.82,
116+
581.4,
117+
581.32,
118+
581.44,
119+
581.68,
120+
581.17,
121+
580.53,
122+
580.01,
123+
579.91,
124+
579.14,
125+
579.16,
126+
579.55,
127+
579.67,
128+
578.44,
129+
578.24,
130+
579.1,
131+
579.09,
132+
579.35,
133+
578.82,
134+
579.32,
135+
579.01,
136+
579,
137+
579.8,
138+
579.83,
139+
579.72,
140+
579.89,
141+
580.01,
142+
579.37,
143+
578.69,
144+
578.19,
145+
578.67,
146+
579.55,
147+
578.92,
148+
578.09,
149+
579.37,
150+
580.13,
151+
580.14,
152+
579.51,
153+
579.24,
154+
578.66,
155+
578.86,
156+
578.05,
157+
577.79,
158+
576.75,
159+
576.75,
160+
577.82,
161+
578.64,
162+
580.58,
163+
579.48,
164+
577.38,
165+
576.9,
166+
576.94,
167+
576.24,
168+
576.84,
169+
576.85,
170+
576.9,
171+
577.79,
172+
578.18,
173+
577.51,
174+
577.23,
175+
578.42,
176+
579.61,
177+
579.05,
178+
579.26,
179+
579.22,
180+
579.38,
181+
579.1,
182+
577.95,
183+
578.12,
184+
579.75,
185+
580.85,
186+
580.41,
187+
579.96,
188+
579.61,
189+
578.76,
190+
578.18,
191+
577.21,
192+
577.13,
193+
579.1,
194+
578.25,
195+
577.91,
196+
576.89,
197+
575.96,
198+
576.8,
199+
577.68,
200+
578.38,
201+
578.52,
202+
579.74,
203+
579.31,
204+
579.89,
205+
579.96,
206+
0
207+
],
208+
"line": {
209+
"color": "transparent",
210+
"width": 2,
211+
"dash": "solid",
212+
"shape": "linear"
213+
},
214+
"fill": "tozeroy",
215+
"fillcolor": "rgba(51,51,51,0.4)",
216+
"xaxis": "x1",
217+
"yaxis": "y1",
218+
"showlegend": false,
219+
"type": "scatter"
220+
}
221+
],
222+
"layout": {
223+
"titlefont": {
224+
"family": ""
225+
},
226+
"showlegend": false,
227+
"xaxis": {
228+
"title": "year",
229+
"type": "linear",
230+
"showgrid": true,
231+
"zeroline": false,
232+
"showline": false,
233+
"ticks": "outside",
234+
"showticklabels": true,
235+
"tickcolor": "rgb(127,127,127)",
236+
"gridcolor": "rgb(255,255,255)"
237+
},
238+
"yaxis": {
239+
"title": "level",
240+
"type": "linear",
241+
"showgrid": true,
242+
"zeroline": false,
243+
"showline": false,
244+
"ticks": "outside",
245+
"showticklabels": true,
246+
"tickcolor": "rgb(127,127,127)",
247+
"gridcolor": "rgb(255,255,255)"
248+
},
249+
"legend": {
250+
"x": 1.05,
251+
"y": 0.5,
252+
"font": {
253+
"family": ""
254+
},
255+
"bgcolor": "rgb(255,255,255)",
256+
"bordercolor": "transparent",
257+
"xanchor": "center",
258+
"yanchor": "top"
259+
},
260+
"margin": {
261+
"r": 10
262+
},
263+
"paper_bgcolor": "rgb(255,255,255)",
264+
"plot_bgcolor": "rgb(229,229,229)"
265+
}
266+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://plot.ly/~TestBot/820

tests/testthat/test-ggplot-area.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ test_that("sanity check for geom_area", {
1111
expect_identical(L[[1]]$type, "scatter")
1212
expect_equal(L[[1]]$x, c(huron$year[1], huron$year, tail(huron$year, n=1)))
1313
expect_equal(L[[1]]$y, c(0, huron$level, 0))
14+
expect_identical(L[[1]]$line$color, "transparent")
1415
})
1516

1617
save_outputs(ar, "area")
18+
19+
# Test alpha transparency in fill color
20+
gg <- ggplot(huron) + geom_area(aes(x=year, y=level), alpha=0.4)
21+
L <- gg2list(gg)
22+
23+
test_that("transparency alpha in geom_area is converted", {
24+
expect_identical(L[[1]]$line$color, "transparent")
25+
expect_identical(L[[1]]$fillcolor, "rgba(51,51,51,0.4)")
26+
})
27+
28+
save_outputs(gg, "area-fillcolor")

0 commit comments

Comments
 (0)