-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add prompt text to top of docs code examples
- Loading branch information
Showing
27 changed files
with
42 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// array example | ||
// a scatter plot of points with emojis for: mount fuji, a rocket, a whale, a watermellon, and a donut | ||
let emoji = zip(range(1, 6), ['🗻', '🚀', '🐋', '🍉', '🍩']); | ||
let points = Points(emoji.map(([i, e]) => [Text(e), [i, i]]), {size: 0.4}); | ||
let plot = Plot(points, {xlim: [0, 6], ylim: [0, 6]}); | ||
let frame = Frame(plot, {margin: 0.15}); | ||
return frame; | ||
return frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// make a circle in a box | ||
// a circle placed off-center in a box | ||
let circle = Circle({pos: [0.4, 0.4], rad: 0.25}); | ||
let frame = Frame(circle, {margin: 0.1, border: 1}); | ||
return frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// gum logo | ||
// The text "GUM" is a simple frame | ||
let text = Text('GUM'); | ||
let frame = Frame(text, {padding: 0.1, border: 1, margin: 0.1}); | ||
return frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// make a rectangle | ||
// a rectangle on the left side of the figure with an aspect of roughly 1/2 | ||
let rect = Rect({rect: [0.2, 0.2, 0.5, 0.7]}); | ||
let frame = Frame(rect, {margin: 0.1}); | ||
return frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// text greeting | ||
// The text "Hello World!" in bold is placed near the botton left of the figure, which has an aspect of roughly 2. | ||
let text = Text('Hello World!', {font_weight: 'bold'}); | ||
return Place(text, {pos: [0.35, 0.7], rad: 0.2, aspect: phi}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// Four by three grid of boxes, each with a different emoji in it. The emojis are a random selection of fruits and candies. | ||
let data = [ | ||
let emoji = [ | ||
'🍩🍦🍨🍫🍌', | ||
'🍕🍉🍒🍇🍐', | ||
'🥝🍎🍓🍬🍪', | ||
] | ||
let rows = data.map(s => [...s].map(c => Node(c, {aspect: 1}))); | ||
let grid = Grid(rows); | ||
]; | ||
let nodes = emoji.map(row => [...row].map(s => Node(s, {flex: true}))); | ||
let aspect = max(...nodes.map(r => r.length))/nodes.length; | ||
let grid = Grid(nodes, {aspect}); | ||
return Frame(grid, {margin: 0.1}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,12 @@ | ||
// Three rows of nodes connected by lines. The first row has three nodes for product categories 1, 2, and 3. The second row has three nodes for Wikipedia text 1, 2, and 3. And the third row has five notes for patent abstract 1 through 5. The first two rows are connected by bi-directional filled in arrows. The second and third rows are partially connected by curved lines. | ||
|
||
// define cell data | ||
let locs = range(5).map(i => 0.2*i+0.1); | ||
let cells1 = [null, ...range(1, 4).map(i => ['Product', `Category ${i}`]), null]; | ||
let cells2 = [null, ...range(1, 4).map(i => ['Wikipedia', `Text ${i}`]), null]; | ||
let cells3 = range(1, 6).map(i => ['Patent', `Abstract ${i}`]); | ||
|
||
// make cell rows | ||
let noder = s => (s == null) ? Spacer() : Node(s, { | ||
aspect: 3, padding: 0.2, flex: true, border_radius: 0.05 | ||
let conns = [[1, 1], [1, 2], [3, 3], [2, 4], [3, 5]]; | ||
return Network([ | ||
...range(1, 4).map(i => [`pc${i}`, ['Product' , `Category ${i}`], [i+1, 1], 0.4]), | ||
...range(1, 4).map(i => [`wt${i}`, ['Wikipedia', `Text ${i}` ], [i+1, 3], 0.4]), | ||
...range(1, 6).map(i => [`pa${i}`, ['Patent' , `Abstract ${i}`], [i , 5], 0.4]), | ||
], [ | ||
...range(1, 4).map(i => [`pc${i}`, `wt${i}`, {arrow: true}]), | ||
...conns.map(([i1, i2]) => [[`wt${i1}`, 'south'], [`pa${i2}`, 'north']]) | ||
], { | ||
aspect: phi, coord: [0, 0, 6, 6], node_border_radius: 0.05, edge_arrow_size: 0.1 | ||
}); | ||
let [row1, row2, row3] = [cells1, cells2, cells3].map( | ||
c => HStack(c.map(noder), {spacing: 0.02}) | ||
); | ||
|
||
// make various edges | ||
let bidi = Edge([0.5, 0], [0.5, 1], { | ||
arrow_beg: true, arrow_end: true, arrow_size: [0.1, 0.075], arrow_fill: '#DDD', arrow_base: true | ||
}); | ||
let edges1 = HStack([Spacer(), bidi, bidi, bidi, Spacer()]); | ||
let elocs2 = [[0, 1], [1, 1], [2, 3], [3, 2], [4, 3]].map( | ||
([x1, x2]) => [[locs[x1], 1], [locs[x2], 0]] | ||
); | ||
let edges2 = Group(elocs2.map(([p1, p2]) => Edge(p1, p2))); | ||
|
||
// stack together and frame | ||
let rows = VStack([row1, edges1, row2, edges2, row3], {aspect: phi}); | ||
return Frame(rows, {margin: 0.05}); |
This file was deleted.
Oops, something went wrong.