Skip to content

Commit

Permalink
reduce testscripts 1 (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattriks authored May 1, 2020
1 parent 384243b commit b231f1b
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 130 deletions.
18 changes: 18 additions & 0 deletions test/testscripts/bar.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using RDatasets, Gadfly

set_default_plot_size(8inch, 8inch)

# discrete_bar, discrete_bar_horizontal, discrete_bar_horizontal_spacing, histogram_errorbar
df = dataset("plm", "Cigar")

p1 = plot(df, x=:Year, y=:Sales, Scale.x_discrete, Geom.bar)
p2 = plot(df, x=:Sales, y=:Year, Scale.y_discrete, Geom.bar(orientation=:horizontal))
p3 = plot(df, x=:Sales, y=:Year, Scale.y_discrete,
Geom.bar(orientation=:horizontal),
Theme(bar_spacing=1mm, minor_label_font_size=5pt))
df1 = df[df.State.==1, :]
ymin, ymax = df1.Sales.-20*0.23, df1.Sales.+20*0.34
p4 = plot(df1, x=:Year, y=:Sales, ymin=ymin, ymax=ymax, Geom.bar, Geom.errorbar)


gridstack([p1 p2; p3 p4])
7 changes: 0 additions & 7 deletions test/testscripts/colorful_hist.jl

This file was deleted.

24 changes: 24 additions & 0 deletions test/testscripts/contour.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Gadfly

set_default_plot_size(6.6inch, 6.6inch)

# contour_color_none, contour_function, contour_layers, contour_matrix
xs = 1:10.
ys = xs
zs = Float64[x^2*log(y) for x in xs, y in ys]

f(x,y) = x*exp(-(x-(round(Int, x)))^2-y^2)
M = Array{Float64}(undef, 200, 200)
for (i, x) in enumerate(range(-8., stop=8., length=200)), (j, y) in enumerate(range(-2., stop=2., length=200))
M[i, j] = f(x, y)
end

p1 = plot(x=xs, y=ys, z=zs, Geom.contour, Scale.color_none)
p2 = plot((x,y) -> x*exp(-(x-(round(Int, x)))^2-y^2), -8., 8, -2., 2)
p3 = plot(layer((x,y) -> x*exp(-(x-(round(Int, x)))^2-y^2), -8., 8, -2., 2),
layer((x, y) -> sqrt(hypot(x, y)), -2, 2, -1, 1),
layer(x=[3], y=[1.5], Geom.point))
p4 = plot(z=M, Geom.contour, xmin=[-8.], xmax=[8], ymin=[-2.], ymax=[2])


gridstack([p1 p2; p3 p4])
8 changes: 0 additions & 8 deletions test/testscripts/contour_color_none.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/contour_function.jl

This file was deleted.

7 changes: 0 additions & 7 deletions test/testscripts/contour_layers.jl

This file was deleted.

11 changes: 0 additions & 11 deletions test/testscripts/contour_matrix.jl

This file was deleted.

5 changes: 0 additions & 5 deletions test/testscripts/discrete_bar.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/discrete_bar_horizontal.jl

This file was deleted.

8 changes: 0 additions & 8 deletions test/testscripts/discrete_bar_horizontal_spacing.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/dodged_discrete_histogram.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/dodged_discrete_histogram_horizontal.jl

This file was deleted.

25 changes: 25 additions & 0 deletions test/testscripts/histogram.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using RDatasets, Gadfly

set_default_plot_size(9inch, 9inch)

df1 = dataset("ggplot2", "diamonds")
df2 = dataset("car", "SLID")

# colorful_hist, histogram_density, histogram_explicit_bins
p1 = plot(df1, x=:Price, color=:Cut, Geom.histogram)
# p2: see issue #880
p2 = plot(df1, x=:Price, color=:Cut, Geom.histogram(bincount=30, density=true))
p3 = plot(df1, x=:Price, Geom.histogram(bincount=30))

# stacked_continuous_histogram, stacked_discrete_histogram, stacked_discrete_histogram_horizontal
p4 = plot(df2, x=:Wages, color=:Language, Geom.histogram)
p5 = plot(df2, x=:Wages, color=:Language, Geom.histogram(position=:stack))
p6 = plot(df2, color=:Language, y=:Wages, Geom.histogram(position=:stack, orientation=:horizontal))

# dodged_discrete_histogram, dodged_discrete_histogram_horizontal
p7 = plot(df2, x=:Wages, color=:Language, Geom.histogram(position=:dodge))
p8 = plot(df2, y=:Wages, color=:Language, Geom.histogram(position=:dodge, orientation=:horizontal))
p9 = plot()


gridstack([p1 p2 p3; p4 p5 p6; p7 p8 p9])
7 changes: 0 additions & 7 deletions test/testscripts/histogram_density.jl

This file was deleted.

11 changes: 0 additions & 11 deletions test/testscripts/histogram_errorbar.jl

This file was deleted.

5 changes: 0 additions & 5 deletions test/testscripts/histogram_explicit_bins.jl

This file was deleted.

5 changes: 0 additions & 5 deletions test/testscripts/single_boxplot.jl

This file was deleted.

10 changes: 0 additions & 10 deletions test/testscripts/single_datetime.jl

This file was deleted.

11 changes: 11 additions & 0 deletions test/testscripts/single_items.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Dates, Gadfly

set_default_plot_size(6inch, 3inch)

# single_datetime, single_boxplot, single_violin

p1 = plot(x=[unix2datetime(100)], y=[10], Geom.point)
p2 = plot(y=randn(100), Geom.boxplot)
p3 = plot(y=randn(100), Geom.violin)

hstack(p1, p2, p3)
5 changes: 0 additions & 5 deletions test/testscripts/single_violin.jl

This file was deleted.

5 changes: 0 additions & 5 deletions test/testscripts/stacked_continuous_histogram.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/stacked_discrete_histogram.jl

This file was deleted.

6 changes: 0 additions & 6 deletions test/testscripts/stacked_discrete_histogram_horizontal.jl

This file was deleted.

0 comments on commit b231f1b

Please sign in to comment.