Skip to content

Instantly share code, notes, and snippets.

View AnupJoseph's full-sized avatar
💭
Coding

AnupJoseph

💭
Coding
View GitHub Profile
fig.add_annotation(x=223,y=1.04,text="1.04m of snow in 1982 is the absolute record",showarrow=True)
fig.show()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Specification Keyword RGB hex value
CSS Level 1 black #000000
CSS Level 1 silver #c0c0c0
CSS Level 1 gray #808080
CSS Level 1 white #ffffff
CSS Level 1 maroon #800000
CSS Level 1 red #ff0000
CSS Level 1 purple #800080
CSS Level 1 fuchsia #ff00ff
CSS Level 1 green #008000
padding=('SAME' if strides == 1 else 'VALID')
<script>
import { csv, scaleBand, scaleLinear, max } from "d3";
import { onMount } from "svelte";
import { fly } from "svelte/transition";
let dataset = [];
const row = function (data) {
data["Population"] = +data["2020"] * 1000; // + here is the unary conversion operator
return data;
};
@AnupJoseph
AnupJoseph / App.svelte
Created October 15, 2021 06:26
Scatter plot with D3 and Svelte
<script>
import { csv, extent, scaleLinear, scaleOrdinal } from "d3";
import { onMount } from "svelte";
import Axis from "./Axis.svelte";
let dataset = [];
const row = function (data) {
data.sepal_length = +data.sepal_length;
data.sepal_width = +data.sepal_width;
<script>
import { csv, extent, scaleLinear, scaleOrdinal } from "d3";
import { onMount } from "svelte";
import Axis from "./Axis.svelte";
import { petalPaths } from "./paths";
let dataset = [];
const row = function (data) {
data.sepal_length = +data.sepal_length;
@AnupJoseph
AnupJoseph / Axis.svelte
Created October 19, 2021 05:01
Simple line chart with Svelte
<script>
import { select, selectAll } from "d3-selection";
import { axisBottom, axisLeft } from "d3-axis";
import { timeFormat } from "d3-time-format";
export let innerHeight;
export let margin;
export let position;
export let scale;
@AnupJoseph
AnupJoseph / Axis.svelte
Created October 20, 2021 04:41
Line Chart with Animation using Svelte and D3
<script>
import { select, selectAll } from "d3-selection";
import { axisBottom, axisLeft } from "d3-axis";
import { timeFormat } from "d3-time-format";
export let innerHeight;
export let margin;
export let position;
export let scale;
@AnupJoseph
AnupJoseph / App.svelte
Created November 15, 2021 07:28
Map with Svelte
<script>
import { json } from "d3";
import Marks from "./Marks.svelte";
let dataset = [];
json(
"https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/world.geojson"
).then((data) => {
dataset = data.features;