Skip to content

Instantly share code, notes, and snippets.

@mdcscry
Last active August 29, 2015 14:12
Show Gist options
  • Save mdcscry/ab8b613ca00de4f31b05 to your computer and use it in GitHub Desktop.
Save mdcscry/ab8b613ca00de4f31b05 to your computer and use it in GitHub Desktop.
VeggieCirclePack 2014

Circle pack enclosure of my seed grown 2014 garden. I'm a high plains gardener in Boulder, Colorado. We get ~20 inches of rain per year. I have a fully irrigated 9 bed garden on the east side of my south facing house. This is garden number 13+ for me. My first in 2001 was in Lafayette, Colorado. I planted in Lafayette in 2011 and moved to Boulder. I harvested a late season container salad garden in 2011. That's the + in 13+. I've been building out this new patch since then. Seed sewing and growing log found at PoppySeed. Garden-of-eatin has a record of the gardens since 2004. I'm a reticent blogger at best, but a 2014 review is in progress.

Other viz include:
Veggie 2014 Show Reel
VeggieBurst 2014

<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
cursor: pointer;
display: inline;
font: 8px "Helvetica Neue", Helvetica, Arial, sans-serif;
text-anchor: middle;
text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 -1px 0 #fff;
}
.node:hover {
stroke: #000;
stroke-width: 1.5px;
}
.node--leaf {
fill: lightblue;
}
.label {
font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
text-anchor: middle;
text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 -1px 0 #fff;
}
.label,
.node--root,
.node--leaf {
pointer-events: none;
}
</style>
<body>
<Div style="position:absolute;left:20;top:20;width:15%;color:white;font-size:1em;"><b>2014 Garden<br> Circle Pack Viz</b><br><a href=http://bl.ocks.org/mbostock/7607535>D3 example</a></DIV>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {console.log("in launchFullScreen");
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
var margin = 20,
diameter = window.innerHeight-100/2;
wdiameter = window.innerWidth-100/2;
var color = d3.scale.linear()
.domain([-1, 3])
.range(["hsl(152,80%,80%)", "hsl(228,30%,40%)"])
.interpolate(d3.interpolateHcl);
var pack = d3.layout.pack()
.padding(2)
.size([diameter - margin, diameter - margin])
.value(function(d) { return d.size; })
var svg = d3.select("body").append("svg")
.attr("width", diameter*2)
.attr("height", diameter)
.append("g")
.attr("transform", "translate(" + wdiameter / 2 + "," + diameter / 2 + ")");
window.addEventListener("resize", function(){ console.log("resize registered");
svg.attr("width", window.outerWidth -10/2)
.attr("height", window.innerHeight -10/2);
w = window.outerWidth - 10/2,
h = window.innerHeight - 10/2;
console.log("h=" + h);
});
d3.json("veggieflare.json", function(error, root) {
if (error) return console.error(error);
var focus = root,
nodes = pack.nodes(root),
view;
var circle = svg.selectAll("circle")
.data(nodes)
.enter().append("circle")
.attr("class", function(d) { return d.parent ? d.children ? "node" : "node node--leaf" : "node node--root"; })
.style("fill", function(d) { return d.children ? color(d.depth) : null; })
.on("click", function(d) { if (focus !== d) zoom(d), d3.event.stopPropagation(); });
var text = svg.selectAll("text")
.data(nodes)
.enter().append("text")
.attr("class", "label")
.style("fill-opacity", function(d) { return d.children ? 1 : 0; })
.style("display", function(d) { return d.children ? null : "none"; })
.text(function(d) { return d.name; })
var node = svg.selectAll("circle,text");
d3.select("body")
.style("background", color(-1))
.on("click", function() { zoom(root); });
zoomTo([root.x, root.y, root.r * 2 + margin]);
function zoom(d) {
var focus0 = focus; focus = d;
var transition = d3.transition()
.duration(d3.event.altKey ? 7500 : 750)
.tween("zoom", function(d) {
var i = d3.interpolateZoom(view, [focus.x, focus.y, focus.r * 2 + margin]);
return function(t) { zoomTo(i(t)); };
});
transition.selectAll("text")
.filter(function(d) { return d.parent === focus || this.style.display === "inline"; })
.style("fill-opacity", function(d) { return d.parent === focus ? 1 : 0; })
.each("start", function(d) { if (d.parent === focus) this.style.display = "inline"; })
.each("end", function(d) { if (d.parent !== focus) this.style.display = "none"; });
}
function zoomTo(v) {
var k = diameter / v[2]; view = v;
node.attr("transform", function(d) { return "translate(" + (d.x - v[0]) * k + "," + (d.y - v[1]) * k + ")"; });
circle.attr("r", function(d) { return d.r * k; });
}
window.addEventListener("resize", function(){ console.log("resize registered");
svg.attr("width", window.outerWidth )
.attr("height", window.innerHeight + 20);
w = window.outerWidth - 20,
h = window.innerHeight - 20;
console.log("h=" + h);
});
launchFullScreen(svg);
});
d3.select(self.frameElement).style("height", diameter + "px");
</script>
{
"name": "",
"children": [
{
"name": "Brassica",
"children": [
{ "name": "CavoloBroccoloSpigariello", "size": 31 },
{ "name": "PieracicabaOPCalabrese", "size": 31 },
{ "name": "FalstaffPurpleBrussels", "size": 31 },
{ "name": "Igloo", "size": 31 },
{ "name": "KaleCavoloNeroakaLacinato", "size": 31 },
{ "name": "RedRussian", "size": 31 },
{ "name": "Scotch", "size": 31 },
{ "name": "AzureStarKohlrabi", "size": 31 },
{ "name": "BrocolliRaab", "size": 31 },
{ "name": "SharakuKomatsu", "size": 31 },
{ "name": "PurpleRapaMixGenePool", "size": 31 }
]},
{
"name": "Celery",
"children": [
{ "name": "GiantRedRe-Selection", "size": 31 },
{ "name": "Tendercrisp", "size": 31 },
{ "name": "Tango", "size": 31 },
{ "name": "D_elne", "size": 31 },
{ "name": "GoldenSpartan", "size": 31 },
{ "name": "Redventure", "size": 31 },
{ "name": "Conquistador", "size": 31 },
{ "name": "DoratoGigante", "size": 31 },
{ "name": "VerdePascal", "size": 31 },
{ "name": "PeppermintStickSeeds", "size": 31 },
{ "name": "Ventura", "size": 31 },
{ "name": "Redventure", "size": 31 },
{ "name": "TallUtah", "size": 31 }
]},
{
"name": "SpinachBeetsChard",
"children": [
{ "name": "BrightLightsChard", "size": 31 },
{ "name": "FordhookGiant", "size": 31 },
{ "name": "Touchstone Gold Beet ", "size": 31 },
{ "name": "Early Blood Turnip ", "size": 31 },
{ "name": "Early Wonder Beat", "size": 31 },
{ "name": "Bloomsdale", "size": 31 }
]},
{
"name": "Radish",
"children": [
{ "name": "Bartender", "size": 31 },
{ "name": "CherryBelle", "size": 31 },
{ "name": "EasterEgg", "size": 31 },
{ "name": "Sparkler", "size": 31 },
{ "name": "Miyashige", "size": 31 },
{ "name": "Watermelon", "size": 31 },
{ "name": "LongBlackSpanish", "size": 31 }
]},
{
"name": "Pea",
"children": [
{ "name": "PetitePoisPrecoville", "size": 31 },
{ "name": "SugarSnap", "size": 31 },
{ "name": "OregonSugarPodII", "size": 31 },
{ "name": "Frosty", "size": 31 },
{ "name": "CoralShellPeas", "size": 31 },
{ "name": "OregonSugarPodII", "size": 31 }
]},
{
"name": "Chicory&Endive",
"children": [
{ "name": "BiancadiBergamo", "size": 31 },
{ "name": "PandiZucchero", "size": 31 },
{ "name": "RossadiTreviso", "size": 31 },
{ "name": "OrchideaRossa", "size": 31 },
{ "name": "PallaRossaPrecoce", "size": 31 },
{ "name": "VariegatadiLusia", "size": 31 },
{ "name": "VerigatadiCastelfranco", "size": 31 },
{ "name": "VariegatadiChioggia", "size": 31 },
{ "name": "Bubikobf", "size": 31 },
{ "name": "BiondaaCuorePieno", "size": 31 },
{ "name": "Louviers", "size": 31 },
{ "name": "CuordOro", "size": 31 },
{ "name": "Castelfranco", "size": 31 }
]},
{
"name": "Greens",
"children": [
{ "name": "Roquette(Arugula)", "size": 31 },
{ "name": "CornMache", "size": 31 },
{ "name": "WinterDensityBibb", "size": 31 },
{ "name": "Tango", "size": 31 },
{ "name": "CardinaleBatavian", "size": 31 },
{ "name": "RedVelvet", "size": 31 },
{ "name": "MarvelofFourSeasons", "size": 31 },
{ "name": "Forellenschluss", "size": 31 },
{ "name": "Tatsoi", "size": 31 },
{ "name": "RubyStreaks(Mustard)", "size": 31 }
]},
{
"name": "Other",
"children": [
{ "name": "Red Amaranth", "size": 31 },
{ "name": "Purple of Romanga", "size": 31 },
{ "name": "FalstaffPurpleBrussels", "size": 31 },
{ "name": "(Kulli)BlackIncanCorn", "size": 31 },
{ "name": "RosaBianca", "size": 31 },
{ "name": "PintungLong", "size": 31 },
{ "name": "JingOrangeOkra", "size": 31 },
{ "name": "RedBurgundy", "size": 31 },
{ "name": "PinkOkra", "size": 31 },
{ "name": "PurpleDeMilpa", "size": 31 }
]},
{
"name": "Squash",
"children": [
{ "name": "Ornamental", "children": [
{ "name": "JapaneseNestEggGourd", "size": 31 },
{ "name": "TennesseeDancingGourd", "size": 31 },
{ "name": "SnakeGourd", "size": 31 }
]},
{ "name": "Summer", "children": [
{ "name": "Lemon", "size": 31 },
{ "name": "Tromboncino", "size": 31 },
{ "name": "StriatodItalia", "size": 31 },
{ "name": "RugosaFriulana", "size": 31 }
]},
{ "name": "Winter", "children": [
{ "name": "FutsuBlack", "size": 31 },
{ "name": "RedKuri", "size": 31 },
{ "name": "BlueKuri", "size": 31 },
{ "name": "UchikiKuri", "size": 31 },
{ "name": "BurgessButtercup", "size": 31 },
{ "name": "SmallSugar", "size": 31 },
{ "name": "VifDtampes", "size": 31 },
{ "name": "Jahrrdale", "size": 31 },
{ "name": "RedWartyThing", "size": 31 },
{ "name": "MusqueedeProvence", "size": 31 },
{ "name": "Jacko'Lantern", "size": 31 },
{ "name": "Kikuza", "size": 31 },
{ "name": "QueenslandBlue", "size": 31 }
]}
]
},
{
"name": "Carrot",
"children": [
{ "name": "Red-Samurai", "size": 31 },
{ "name": "Purple-Sun", "size": 31 },
{ "name": "Yellowstone", "size": 31 },
{ "name": "Snow-White", "size": 31 },
{ "name": "White-Satin", "size": 31 },
{ "name": "Purple-68", "size": 31 },
{ "name": "Rotild", "size": 31 },
{ "name": "Starica", "size": 31 },
{ "name": "Dragon", "size": 31 },
{ "name": "San-Valerio", "size": 31 },
{ "name": "Touchon", "size": 31 },
{ "name": "St.Valery", "size": 31 },
{ "name": "Rainbow-Blend", "size": 31 },
{ "name": "Chablis-Yellow", "size": 31 },
{ "name": "Kyoto-Red", "size": 31 },
{ "name": "Mokum", "size": 31 },
{ "name": "Scarlet-Nantes", "size": 31 },
{ "name": "Solar Yellow", "size": 31 },
{ "name": "Lunar White", "size": 31 },
{ "name": "Amarillo", "size": 31 },
{ "name": "Scarlet Red", "size": 31 }
]
},
{
"name": "Pepper",
"children": [
{ "name": "SweetChocolate", "size": 31 },
{ "name": "Fresno", "size": 31 },
{ "name": "Volcano", "size": 31 },
{ "name": "PasoBajillo", "size": 31 },
{ "name": "Poblano", "size": 31 },
{ "name": "OrangeBell", "size": 31 },
{ "name": "Fish", "size": 31 },
{ "name": "TequilaSunrise", "size": 31 },
{ "name": "CalWonder", "size": 31 },
{ "name": "CanaryBell", "size": 31 },
{ "name": "EarlyJalapeno", "size": 31 },
{ "name": "SweetRoundHungarian", "size": 31 },
{ "name": "Serrano", "size": 31 },
{ "name": "BlackHungarian", "size": 31 },
{ "name": "SweetCherryBlend", "size": 31 },
{ "name": "GantSzegedi", "size": 31 },
{ "name": "NewMexico#6Chile", "size": 31 }
]
},
{
"name": "Tomato",
"children": [
{ "name": "IndigoRoseTomato", "size": 31 },
{ "name": "Trifele", "size": 31 },
{ "name": "BlackFromTula", "size": 31 },
{ "name": "AuntRubysGreen", "size": 31 },
{ "name": "MoonGlow", "size": 31 },
{ "name": "BlackManSea", "size": 31 },
{ "name": "Pomodoro", "size": 31 },
{ "name": "StripedRoma", "size": 31 },
{ "name": "CreamSausage", "size": 31 },
{ "name": "AmanaOrange", "size": 31 },
{ "name": "GoldMedal", "size": 31 },
{ "name": "OrangeBanana", "size": 31 },
{ "name": "JauneFlamme", "size": 31 },
{ "name": "SanMarzano#3", "size": 31 },
{ "name": "AmishPaste", "size": 31 },
{ "name": "Delicious", "size": 31 },
{ "name": "Blondkopfchen", "size": 31 },
{ "name": "BrownBerry", "size": 31 },
{ "name": "MattsWildCherry", "size": 31 },
{ "name": "CherokeePurple", "size": 31 },
{ "name": "GiantBelgium", "size": 31 },
{ "name": "PinkBrandywine", "size": 31 },
{ "name": "Black", "size": 31 },
{ "name": "Nyagous", "size": 31 },
{ "name": "GreenGrape", "size": 31 },
{ "name": "GreenGiant", "size": 31 },
{ "name": "WhiteBeauty", "size": 31 },
{ "name": "PrudensPurple", "size": 31 },
{ "name": "BlackPrince", "size": 31 },
{ "name": "BoxCarWillie", "size": 31 }
]
},
{
"name": "Bean",
"children": [
{ "name": "bush", "children": [
{ "name": "BeurredeRocquencourtwax", "size": 31 },
{ "name": "RajamaIndianpink", "size": 31 },
{ "name": "DragonTongue", "size": 31 },
{ "name": "RoyalBurgundy", "size": 62 },
{ "name": "SoleilFilet", "size": 31 },
{ "name": "ExperimentalVariety(Johnnys)", "size": 31 },
{ "name": "Sequoia", "size": 31 },
{ "name": "Provider", "size": 31 }
]
},
{ "name": "pole", "children": [
{ "name": "Carminat purple Filet", "size": 31 },
{ "name": "PurplePod", "size": 31 },
{ "name": "Neckargold", "size": 31 },
{ "name": "MarvelOfVenice", "size": 31 },
{ "name": "Rattlesnake", "size": 31 }
]
},
{ "name": "other", "children": [
{ "name": "PaintedLadyImprovedRunner", "size": 31 },
{ "name": "SunsetRunner", "size": 31 },
{ "name": "BlueSpeckledTepary", "size": 31 },
{ "name": "BlueGooseCowpea", "size": 31 },
{ "name": "ExtraPrecoceAGranoViolettoFava", "size": 31 },
{ "name": "Thai#3ExtraLong", "size": 31 },
{ "name": "RedNoodleLong", "size": 31 },
{ "name": "VietnameseBlackCowpea", "size": 31 }
]
}
]
},
{ "name": "HERBS",
"children": [
{ "name": "Basil", "children": [
{ "name": "Cardinal", "size": 31 },
{ "name": "Mammoth", "size": 31 },
{ "name": "PurpleRuffles", "size": 31 },
{ "name": "SweetDaniLemon", "size": 31 },
{ "name": "Thai", "size": 31 },
{ "name": "Cinnamon", "size": 31 },
{ "name": "Genovese", "size": 31 },
{ "name": "RedLettuceLeaf", "size": 31 }
]
},
{ "name": "other", "children": [
{ "name": "Borage", "size": 31 },
{ "name": "Cumin", "size": 31 },
{ "name": "DillVierling", "size": 31 },
{ "name": "PerfectionFennel", "size": 31 },
{ "name": "ThaiRedRoselle", "size": 31 },
{ "name": "OrangeGrendadeSaffron", "size": 31 }
]
},
{ "name": "Marjoram", "children": [
{ "name": "Sweet", "size": 31 },
{ "name": "Marcelka", "size": 31 },
{ "name": "Zaatar", "size": 31 }
]
},
{ "name": "Cilantro", "children": [
{ "name": "Slo-Bolt", "size": 31 },
{ "name": "IndianDhannat", "size": 31 }
]
},
{ "name": "Parsley", "children": [
{ "name": "Krause", "size": 31 },
{ "name": "ItalianFlatLeaf", "size": 31 },
{ "name": "Curled", "size": 31 }
]
},
{ "name": "Oregano", "children": [
{ "name": "Greek", "size": 31 },
{ "name": "Standard", "size": 31 }
]
}
]
},
{ "name": "ALLIUM",
"children": [
{ "name": "garlic", "children": [
{ "name": "whitestorebought", "size": 31 },
{ "name": "purplefrommarilyn", "size": 31 }
]
},
{
"name": "Shallot",
"children": [
{ "name": "Picador", "size": 31 },
{ "name": "Conservor", "size": 31 },
{ "name": "Ambition", "size": 31 },
{ "name": "Saffron", "size": 31 }
]
},
{
"name": "Onion",
"children": [
{ "name": "Borettana", "size": 31 }
]
}
]
},
{ "name": "FLOWERS",
"children": [
{ "name": "Display", "children": [ {
"name": "Dahlia-Fireworks",
"size": 31
},
{ "name": "AmaranthLasVegasPurpleGlobe", "size": 31 },
{ "name": "ZinniaJazzyMix", "size": 31 },
{ "name": "SalviaBlueAngel", "size": 31 },
{ "name": "SunflowerCherryRose", "size": 31 },
{ "name": "Lobelia-CrystalPalace", "size": 31 },
{ "name": "Lobelia-Blue", "size": 31 },
{ "name": "CastorBeanCamencita", "size": 31 },
{ "name": "SalviaCambridgeBlue", "size": 31 }
]
},
{
"name": "Edible",
"children": [
{ "name": "SolarFlashbackCalendula", "size": 31 },
{ "name": "NasturtiumPeachMelba", "size": 31 },
{ "name": "Saffron", "size": 31 }
]
},
{
"name": "Grasses",
"children": [
{ "name": "SorghamBlack", "size": 31 },
{ "name": "VariegatedCorn", "size": 31 },
{ "name": "JesterMillet", "size": 31 },
{ "name": "RubySilkLoveGrass", "size": 31 }
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment