-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
- Loading branch information
There are no files selected for viewing
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]) |
This file was deleted.
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]) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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]) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.