Skip to content

Commit f3b283d

Browse files
committed
shorten filenames with directory structure for travis compliance
1 parent e1faf05 commit f3b283d

File tree

518 files changed

+167
-167
lines changed

Some content is hidden

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

518 files changed

+167
-167
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ R/.Rhistory
22
Rapp.history
33
/Karthik_local.R
44
*~
5-
.Rhistory
5+
.Rhistory
6+
.RData

run_tests_with_outputs.R

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@ library(plotly)
33

44
setwd("tests")
55

6-
save_outputs <- function(gg, name, ignore_ggplot=FALSE) {
7-
filesystem_name <- gsub('/', '--', name)
8-
filesystem_name <- gsub(' ', '_', filesystem_name)
6+
save_outputs <- function(gg, name, ignore_ggplot=FALSE, file_prefix="test-ggplot-") {
7+
filesystem_name <- gsub(' ', '_', name)
98
print(paste("running", name))
109
py <- plotly("TestBot", "r1neazxo9w")
1110
u <- py$ggplotly(gg, kwargs=list(filename=paste0("ggplot2/", name),
1211
fileopt="overwrite", auto_open=FALSE))
1312
plotlyUrl <- u$response$url
14-
writeLines(plotlyUrl, paste0("test-ggplot-", filesystem_name, ".url"))
13+
writeLines(plotlyUrl, paste0(file_prefix, filesystem_name, ".url"))
1514
pngdata <- getURLContent(paste0(u$response$url, ".png"))
16-
writeBin(as.raw(pngdata), paste0("test-ggplot-", filesystem_name, "-plotly.png"))
15+
writeBin(as.raw(pngdata), paste0(file_prefix, filesystem_name, "-plotly.png"))
1716
if (!ignore_ggplot) {
18-
ggsave(paste0("test-ggplot-", filesystem_name, "-ggplot2.png"), plot=gg, w=7, h=5)
17+
ggsave(paste0(file_prefix, filesystem_name, "-ggplot2.png"), plot=gg, w=7, h=5)
1918
}
2019

2120
# save the json
22-
writeLines(getURL(paste0(plotlyUrl, ".json")), paste0("test-ggplot-", filesystem_name, ".json"))
21+
writeLines(getURL(paste0(plotlyUrl, ".json")), paste0(file_prefix, filesystem_name, ".json"))
2322
}
2423

2524
test_check("plotly")

tests/cookbook-test-suite/axes.R

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
bp <- ggplot(PlantGrowth, aes(x=group, y=weight)) + geom_boxplot()
22

33
bp1 <- bp + coord_flip()
4-
save_outputs(bp1, 'axes/coord flip')
4+
save_outputs(bp1, 'axes/coord flip', file_prefix="")
55

66
# Manually set the order of a discrete-valued axis
77
bp2 <- bp + scale_x_discrete(limits=c("trt1","trt2","ctrl"))
8-
save_outputs(bp2, 'axes/discrete valued axes')
8+
save_outputs(bp2, 'axes/discrete valued axes', file_prefix="")
99

1010
# Reverse the order of a discrete-valued axis
1111
# Get the levels of the factor
@@ -15,66 +15,66 @@ flevels <- levels(PlantGrowth$group)
1515
flevels <- rev(flevels)
1616
# "trt2" "trt1" "ctrl"
1717
bp3 <- bp + scale_x_discrete(limits=flevels)
18-
save_outputs(bp3, 'axes/reversed ordered axes - 1')
18+
save_outputs(bp3, 'axes/reversed ordered axes - 1', file_prefix="")
1919

2020
# Or it can be done in one line:
2121
bp4 <- bp + scale_x_discrete(limits = rev(levels(PlantGrowth$group)) )
22-
save_outputs(bp4, 'axes/reversed ordered axes - 2')
22+
save_outputs(bp4, 'axes/reversed ordered axes - 2', file_prefix="")
2323

2424
bp5 <- bp + scale_x_discrete(breaks=c("ctrl", "trt1", "trt2"), labels=c("Control", "Treat 1", "Treat 2"))
25-
save_outputs(bp5, 'axes/setting tick mark labels')
25+
save_outputs(bp5, 'axes/setting tick mark labels', file_prefix="")
2626

2727
# Hide x tick marks, labels, and grid lines
2828
bp6 <- bp + scale_x_discrete(breaks=NULL)
29-
save_outputs(bp6, 'axes/hidden tick marks labels gridline')
29+
save_outputs(bp6, 'axes/hidden tick marks labels gridline', file_prefix="")
3030

3131
# Hide all tick marks and labels (on X axis), but keep the gridlines
3232
bp7 <- bp + theme(axis.ticks = element_blank(), axis.text.x = element_blank())
33-
save_outputs(bp7, 'axes/hidden tick marks and labels')
33+
save_outputs(bp7, 'axes/hidden tick marks and labels', file_prefix="")
3434

3535
# Set the range of a continuous-valued axis
3636
# These are equivalent
3737
bp8 <- bp + ylim(0,8)
38-
save_outputs(bp8, 'axes/set range of continuous-valued axis - 1')
38+
save_outputs(bp8, 'axes/set range of continuous-valued axis - 1', file_prefix="")
3939
bp9 <- bp + scale_y_continuous(limits=c(0,8))
40-
save_outputs(bp9, 'axes/set range of continuous-valued axis - 2')
40+
save_outputs(bp9, 'axes/set range of continuous-valued axis - 2', file_prefix="")
4141

4242
# These two do the same thing; all data points outside the graphing range are dropped,
4343
# resulting in a misleading box plot
4444
bp10 <- bp + ylim(5, 7.5)
45-
save_outputs(bp10, 'axes/misleading range')
45+
save_outputs(bp10, 'axes/misleading range', file_prefix="")
4646
bp + scale_y_continuous(limits=c(5, 7.5))
4747

4848
# Using coord_cartesian "zooms" into the area
4949
bp11 <- bp + coord_cartesian(ylim=c(5, 7.5))
50-
save_outputs(bp11, 'axes/coord_cartesian')
50+
save_outputs(bp11, 'axes/coord_cartesian', file_prefix="")
5151

5252
# Specify tick marks directly
5353
bp12 <- bp + coord_cartesian(ylim=c(5, 7.5)) +
5454
scale_y_continuous(breaks=seq(0, 10, 0.25)) # Ticks from 0-10, every .25
55-
save_outputs(bp12, 'axes/specify tick marks directly')
55+
save_outputs(bp12, 'axes/specify tick marks directly', file_prefix="")
5656

5757
# Reverse order of a continuous-valued axis
5858
bp13 <- bp + scale_y_reverse()
59-
save_outputs(bp13, 'axes/reverse y scale')
59+
save_outputs(bp13, 'axes/reverse y scale', file_prefix="")
6060

6161
# Setting the tick marks on an axis
6262
# This will show tick marks on every 0.25 from 1 to 10
6363
# The scale will show only the ones that are within range (3.50-6.25 in this case)
6464
bp14 <- bp + scale_y_continuous(breaks=seq(1,10,1/4))
65-
save_outputs(bp14, 'axes/manual tick marks')
65+
save_outputs(bp14, 'axes/manual tick marks', file_prefix="")
6666

6767
# The breaks can be spaced unevenly
6868
bp15 <- bp + scale_y_continuous(breaks=c(4, 4.25, 4.5, 5, 6,8))
69-
save_outputs(bp15, 'axes/uneven tick marks')
69+
save_outputs(bp15, 'axes/uneven tick marks', file_prefix="")
7070

7171
# Suppress ticks and gridlines
7272
bp16 <- bp + scale_y_continuous(breaks=NULL)
73-
save_outputs(bp16, 'axes/suppress y ticks labels and gridlines')
73+
save_outputs(bp16, 'axes/suppress y ticks labels and gridlines', file_prefix="")
7474

7575
# Hide tick marks and labels (on Y axis), but keep the gridlines
7676
bp17 <- bp + theme(axis.ticks = element_blank(), axis.text.y = element_blank())
77-
save_outputs(bp17, 'axes/suppress y ticks and labels')
77+
save_outputs(bp17, 'axes/suppress y ticks and labels', file_prefix="")
7878

7979
# Create some noisy exponentially-distributed data
8080
xval = c(0.26932812,-0.05341404,0.36977717,0.91504712,0.46329006,0.37956526, 0.93290644,0.75558976,0.67633497,0.48655293,0.79478162,0.55109982, 0.51681398,0.81073512,0.49406579,0.93919618,0.90472008,0.98732256, 0.94379876,0.95790909,0.54614241,1.13356941,1.13299144,1.18159277, 1.16428407,1.22955005,1.21030897,1.23314811,1.53822718,1.53674330, 1.80020468,1.40774011,1.74573515,1.26651625,2.06607711,1.50237263, 1.38480531,1.83625381,2.35275649,1.99004291,2.80396442,2.20863240, 2.42998876,2.12801180,2.26290348,2.38185989,2.14936036,2.66587947, 2.64586596,2.44240603,2.39266452,3.11831215,2.70258927,2.65529134, 2.65634690,2.95984290,2.71058076,2.87919480,3.07739358,2.66841935, 3.10792706,3.17134285,3.98070271,3.55497279,3.36831009,3.31390892, 3.32753965,2.86981968,3.22741000,3.78806438,3.74434536,3.56928928, 3.83783177,3.24485807,4.05766233,4.13619455,4.26888054,3.47546258, 3.93045819,3.77620080,4.66676431,3.88059240,4.54694485,4.03915767, 4.25556093,4.39251819,4.42692029,4.23262929,4.44890758,4.84981161, 4.51104252,4.33004508,5.06350705,4.89714069,4.21599077,4.55457578, 5.04044393,4.89111297,5.03105215,4.64113164)
@@ -84,34 +84,34 @@ dat <- data.frame(xval = xval, yval = yval)
8484

8585
# A scatterplot with regular (linear) axis scaling
8686
sp <- ggplot(dat, aes(xval, yval)) + geom_point()
87-
save_outputs(sp, 'axes/linear axes')
87+
save_outputs(sp, 'axes/linear axes', file_prefix="")
8888

8989
# log2 scaling of the y axis (with visually-equal spacing)
9090
library(scales) # Need the scales package
9191
sp1 <- sp + scale_y_continuous(trans=log2_trans())
92-
save_outputs(sp1, 'axes/ln y axes with visual-equal spacing')
92+
save_outputs(sp1, 'axes/ln y axes with visual-equal spacing', file_prefix="")
9393

9494
# log2 coordinate transformation (with visually-diminishing spacing)
9595
sp2 <- sp + coord_trans(y="log2")
96-
save_outputs(sp2, 'axes/ln y axes with visually diminishing spacing')
96+
save_outputs(sp2, 'axes/ln y axes with visually diminishing spacing', file_prefix="")
9797

9898
sp3 <- sp + scale_y_continuous(trans = log2_trans(),
9999
breaks = trans_breaks("log2", function(x) 2^x),
100100
labels = trans_format("log2", math_format(2^.x)))
101-
save_outputs(sp3, 'axes/ln y axes with exponent tick marks')
101+
save_outputs(sp3, 'axes/ln y axes with exponent tick marks', file_prefix="")
102102

103103
dat10 <- data.frame(xval = xval, yval = yval)
104104

105105
sp10 <- ggplot(dat10, aes(xval, yval)) + geom_point()
106106

107107
# log10
108108
sp101 <- sp10 + scale_y_log10()
109-
save_outputs(sp101, 'axes/log_10 y axes')
109+
save_outputs(sp101, 'axes/log_10 y axes', file_prefix="")
110110

111111
# log10 with exponents on tick labels
112112
sp102 <- sp10 + scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
113113
labels = trans_format("log10", math_format(10^.x)))
114-
save_outputs(sp102, 'axes/log_10 y axes with exponent tick marks')
114+
save_outputs(sp102, 'axes/log_10 y axes with exponent tick marks', file_prefix="")
115115

116116
# Data where x ranges from 0-10, y ranges from 0-30
117117
set.seed(202)
@@ -120,35 +120,35 @@ sp <- ggplot(dat, aes(xval, yval)) + geom_point()
120120

121121
# Force equal scaling
122122
sp4 <- sp + coord_fixed()
123-
save_outputs(sp4, 'axes/forced equal spacing')
123+
save_outputs(sp4, 'axes/forced equal spacing', file_prefix="")
124124

125125
# Equal scaling, with each 1 on the x axis the same length as y on x axis
126126
sp5 <- sp + coord_fixed(ratio=1/3)
127-
save_outputs(sp5, 'axes/forced equal scaling')
127+
save_outputs(sp5, 'axes/forced equal scaling', file_prefix="")
128128

129129
bp10 <- bp + theme(axis.title.x = element_blank()) + # Remove x-axis label
130130
ylab("Weight (Kg)") # Set y-axis label
131-
save_outputs(bp10, 'axes/axes labels')
131+
save_outputs(bp10, 'axes/axes labels', file_prefix="")
132132

133133
# Also possible to set the axis label with the scale
134134
# Note that vertical space is still reserved for x's label
135135
bp11 <- bp + scale_x_discrete(name="") +
136136
scale_y_continuous(name="Weight (Kg)")
137-
save_outputs(bp11, 'axes/axes labels set with scale')
137+
save_outputs(bp11, 'axes/axes labels set with scale', file_prefix="")
138138

139139
# Change font options:
140140
# X-axis label: bold, red, and 20 points
141141
# X-axis tick marks: rotate 90 degrees CCW, move to the left a bit (using vjust,
142142
# since the labels are rotated), and 16 points
143143
bp12 <- bp + theme(axis.title.x = element_text(face="bold", colour="#990000", size=20),
144144
axis.text.x = element_text(angle=90, vjust=0.5, size=16))
145-
save_outputs(bp12, 'axes/axes labels with formatting')
145+
save_outputs(bp12, 'axes/axes labels with formatting', file_prefix="")
146146

147147
# Label formatters
148148
library(scales) # Need the scales package
149149
bp13 <- bp + scale_y_continuous(labels=percent) +
150150
scale_x_discrete(labels=abbreviate) # In this particular case, it has no effect
151-
save_outputs(bp13, 'axes/axes labels with percent labels')
151+
save_outputs(bp13, 'axes/axes labels with percent labels', file_prefix="")
152152

153153
# Self-defined formatting function for times.
154154
timeHMS_formatter <- function(x) {
@@ -161,20 +161,20 @@ timeHMS_formatter <- function(x) {
161161
}
162162

163163
bp14 <- bp + scale_y_continuous(label=timeHMS_formatter)
164-
save_outputs(bp14, 'axes/axes labels with custom time labels')
164+
save_outputs(bp14, 'axes/axes labels with custom time labels', file_prefix="")
165165

166166
# Hide all the gridlines
167167
bp15 <- bp + theme(panel.grid.minor=element_blank(), panel.grid.major=element_blank())
168-
save_outputs(bp15, 'axes/hidden gridlines')
168+
save_outputs(bp15, 'axes/hidden gridlines', file_prefix="")
169169

170170
# Hide just the minor gridlines
171171
bp16 <- bp + theme(panel.grid.minor=element_blank())
172-
save_outputs(bp16, 'axes/hidden minor gridlines')
172+
save_outputs(bp16, 'axes/hidden minor gridlines', file_prefix="")
173173

174174
# Hide all the horizontal gridlines
175175
bp17 <- bp + theme(panel.grid.minor.x=element_blank(), panel.grid.major.x=element_blank())
176-
save_outputs(bp17, 'axes/hidden horizontal gridlines')
176+
save_outputs(bp17, 'axes/hidden horizontal gridlines', file_prefix="")
177177

178178
# Hide all the vertical gridlines
179179
bp18 <- bp + theme(panel.grid.minor.y=element_blank(), panel.grid.major.y=element_blank())
180-
save_outputs(bp18, 'axes/hidden vertical gridlines')
180+
save_outputs(bp18, 'axes/hidden vertical gridlines', file_prefix="")

0 commit comments

Comments
 (0)