Skip to content

Commit

Permalink
Merge pull request #6 from tpapp/histogram-examples
Browse files Browse the repository at this point in the history
Added two simple histogram examples.
  • Loading branch information
fredo-dedup committed Aug 30, 2016
2 parents 29f21a6 + e07902b commit cefe12c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/histogram.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using VegaLite
using DataFrames

# a simple histogram of random standard normal draws

data_values(DataFrame(x=randn(200))) +
mark_bar() +
encoding_x_quant(:x; bin=Dict(:maxbins=>20), axis=Dict(:title=>"values")) +
encoding_y_quant(:*, aggregate="count", axis=Dict(:title=>"number of draws"))
14 changes: 14 additions & 0 deletions examples/histogram_facet.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using VegaLite
using DataFrames

## histograms by group

df= DataFrame(group=rand(0:1, 200))
df[:x] = df[:group]*2 + randn(size(df,1))

data_values(df) +
mark_bar() +
encoding_x_quant(:x; bin=Dict(:maxbins=>15)) +
encoding_y_quant(:*, aggregate="count") +
encoding_row_nominal(:group) +
encoding_color_nominal(:group)

0 comments on commit cefe12c

Please sign in to comment.