Open chriddyp opened 9 years ago
I checked off the items that I have fixed in #163
use this table to keep track of which cookbook test files from https://github.com/ropensci/plotly/tree/add-r-cookbook-tests/tests/cookbook-test-suite
which have been ported to testthat files under https://github.com/ropensci/plotly/tree/master/tests/testthat
original file | ported by | to file | branch/PR |
---|---|---|---|
axes.R | tdhock | test-cookbook-axes.R | #172 |
bars_and_lines.R | cpsievert | test-ggplot-bar.R | #200 |
distributions.R | cpsievert | test-ggplot-[histogram | density].R |
facets.r | |||
legends.R | |||
lines.R | |||
means_and_error_bars.R | |||
multiple_graphs_on_one_page.r | |||
scatterplots.R | cpsievert | test-cookbook-scatterplots.R | #183 |
titles.R |
It seems like a good number of unimplemented cookbook tests overlap with tests already implemented testhat side. For example, see here and here.
Unless anyone objects, I'm going to favor putting cookbook examples under test-ggplot-*.R
(instead of test-cookbook-*.R
) whenever appropriate
@chriddyp @mkcor @tdhock.
Taking a closer look, I don't think it's really worth adding any of the examples in bars_and_lines.R
. We already have tests for most of it. There are a couple examples that have components that we don't currently test for like theme_bw()
and theme(legend.position = ...)
, but those things have nothing to do with bars/lines.
Pretty sure this is outdated now and superseded by https://github.com/ropensci/plotly/milestone/3
Here are some remaining unsupported features as taken from the great ggplot2 cookbook.
The cookbook examples are in this branch: https://github.com/ropensci/plotly/tree/add-r-cookbook-tests, in this folder: https://github.com/ropensci/plotly/tree/add-r-cookbook-tests/tests/cookbook-test-suite
[x] FIXED #163 line chart with error bars throwing exception "Error in trace.list[[j]] : subscript out of bounds”
example code: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/#line-graphs
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/a45f2c70b7adf484e0b0eb8810a1e59e018adbb8/means_and_error_bars.R#L162-L191
expected outputs: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/line.png http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/line-dodge.png http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/line-dodge-ci.png http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/line-dodge-black.png http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/line-final.png
[x] FIXED #163 manual tick marks expected output: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/bp_y_break.25.png
actual output: https://plot.ly/~ggplot2-cookbook/83/weight-vs-group/
code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R#L70-L71
from: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#setting-and-hiding-tick-markers
[x] FIXED #163 axes tick mark labels see http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#setting-tick-mark-labels
executable code here: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R
[x] FIXED #163 manual range expected output: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/bp_ylim0-8.png
actual output: https://plot.ly/~ggplot2-cookbook/79/weight-vs-group/
code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R#L41-L46
from: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#setting-range-and-reversing-direction-of-an-axis
[ ] sizing expected output: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/sp_coord_fixed.png
actual output: https://plot.ly/~ggplot2-cookbook/87/yval-vs-xval/
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R#L129-L131
from: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#fixed-ratio-between-x-and-y-axes
[x] FIXED #183 geomsmooth great, simple examples here: http://www.cookbook-r.com/Graphs/Scatterplots(ggplot2)/
executable code here: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/scatterplots.R
A user's example here: https://github.com/ropensci/plotly/issues/179
[x] TDH 23 Feb 2015 working on legend doesn't hide expected: http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_(ggplot2)/bar-color-outline-nolegend.png
actual: https://plot.ly/~ggplot2-cookbook/6/total-bill-vs-time/
expected: http://www.cookbook-r.com/Graphs/Plotting_distributions_(ggplot2)/boxplot-fill-nolegend.png actual: https://plot.ly/~ggplot2-cookbook/56/rating-vs-cond/
executable: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/bars_and_lines.R#L28-L32, https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/a45f2c70b7adf484e0b0eb8810a1e59e018adbb8/distributions.R#L103-L106
from: http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_(ggplot2)/
also see our polygons-borders test-case: http://grab.by/B8pa
also see all of the examples that have a hidden legend by default, like "suppress y ticks labels and gridlines" from axes.R
[x] y-axis range expected output: http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_(ggplot2)/line-point-ylim.png
actual output: https://plot.ly/~ggplot2-cookbook/15/total-bill-vs-time/
[x] marker size is too small expected output: http://www.cookbook-r.com/Graphs/Plotting_distributions_(ggplot2)/boxplot-mean.png
actual output: https://plot.ly/~ggplot2-cookbook/57/rating-vs-cond/
code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/a45f2c70b7adf484e0b0eb8810a1e59e018adbb8/distributions.R#L116
from: http://www.cookbook-r.com/Graphs/Plotting_distributions_(ggplot2)/
compare also the ggplot-abline test in our github
see also our test case "test-ggplot-size-global-scaling" and "test-ggplot-size-is-a-vector" and "test-ggplot-size-not-a-vector"
see also our cookbook example "means-and-error-bars/within-subject-error-bars"
also, too big in the example: "scatterplots/scatterplots colored by condition with extended regression line"
[ ] suppressed y ticks, labels, gridlines see example from axes.R: "supress y ticks labels and gridlines"
also: "hidden tick marks marks labels gridline"
[ ] add some more spacing around the graph: expand the range our range is flush against the domain of the axis, we might want to give the graphs a lil more breathing room, or explore just using plotly's autorange: http://grab.by/B8j6
especially noticeable on this one: https://plot.ly/~TestBot/505/mpg-mean-vs-cyl/
also this one: "basic line 2" from "bars-and-lines.R"
also see our cookbook example "basic bar fill colors 1"
[x] geom_rect() Looks like this would be a cool one to add: http://stackoverflow.com/questions/17521438/geom-rect-and-alpha-does-this-work-with-hard-coded-values. An enterprise lead uses it and tried to re-make this plot today.
https://plot.ly/~c_bort/5/test-for-matt-and-rich/
[ ] re-orderding axes labels see http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#changing-the-order-of-items
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R
[ ] reversed continuous scale expected output: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/bp_y_reverse.png
actual output: https://plot.ly/~ggplot2-cookbook/82/weight-vs-group/
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/axes.R#L64-L66
from: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/#reversing-the-direction-of-an-axis
[ ] reverse legend actual output: https://plot.ly/~ggplot2-cookbook/96/weight-vs-group/ expected output: http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/bp-legendorder.png
from: http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/master/legends.R#L23-L26
see also our test "test-ggplot-stack" (although in that case, i think we're doing the correct thing)
[x] FIXED #167 scales="free" in ggplot2 See: https://plot.ly/~zevross/18/staten-island-staten-island-staten-island-staten-island-staten-island-brooklyn-b/. It looks like we almost get it, but are using shared axes on two of them.
ggplot(refdaylong, aes(date, value, color=variable)) + geom_line() + facet_wrap(~year, scales="free")
[ ] graph outline expected output: http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_(ggplot2)/bar2-final.png
actual output: https://plot.ly/~ggplot2-cookbook/26/average-bill-for-2-people/
code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/a45f2c70b7adf484e0b0eb8810a1e59e018adbb8/bars_and_lines.R#L146
from: http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_(ggplot2)/#finished-examples
[ ] second set of error bars missing expected output: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/within-compare-errorbars.png
actual output: https://plot.ly/~ggplot2-cookbook/44/value-vs-condition/
executable code: https://github.com/chriddyp/ggplot2-plotly-cookbook/blob/a45f2c70b7adf484e0b0eb8810a1e59e018adbb8/means_and_error_bars.R#L340
from: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/#understanding-within-subjects-error-bars