-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from nomic-ai/08-29-interpolate_between_old_f…
…oreground_size_and_new_one interpolate between old foreground size and new one
- Loading branch information
Showing
5 changed files
with
137 additions
and
36 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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script> | ||
import { Bitmask, Scatterplot } from '../../src/deepscatter'; | ||
export let scatterplot; | ||
let selectionNumber = 0; | ||
async function makeSelection() { | ||
const selection = await scatterplot.deeptable.select_data({ | ||
name: Math.random().toFixed(8), | ||
tileFunction: async (tile) => { | ||
const b = new Bitmask(tile.manifest.nPoints); | ||
for (let i = 0; i < tile.manifest.nPoints; i++) { | ||
if (Math.random() < 0.001) { | ||
b.set(i); | ||
} | ||
} | ||
return b.to_arrow(); | ||
}, | ||
}); | ||
await selection.ready; | ||
await selection.applyToAllLoadedTiles(); | ||
console.log(selection); | ||
console.log(selection.name); | ||
scatterplot.plotAPI({ | ||
duration: 1000, | ||
background_options: { | ||
size: [0.5, 10], | ||
opacity: [0.8, 3], | ||
color: '#AAAAAA', | ||
}, | ||
encoding: { | ||
foreground: { | ||
field: selection.name, | ||
op: 'gt', | ||
a: 0, | ||
}, | ||
}, | ||
}); | ||
} | ||
</script> | ||
|
||
<div> | ||
<button on:click={() => makeSelection()}>Select Points</button> | ||
<button | ||
on:click={() => scatterplot.plotAPI({ encoding: { foreground: null } })} | ||
>Reset</button | ||
> | ||
</div> |
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