How to add a title to Seaborn Facet Plot

Updating slightly, with seaborn 0.11.1: Seaborn’s relplot function creates a FacetGrid and gives each subplot its own explanatory title. You can add a title over the whole thing: import seaborn as sns tips = sns.load_dataset(‘tips’) rp = sns.relplot(data=tips, x=’total_bill’, y=’tip’, col=”sex”, row=’smoker’, kind=’scatter’) # rp is a FacetGrid; # relplot is a nice organized way … Read more

track C++ memory allocations

Use Valgrind and its tool Massif. Its example output (a part of it): 99.48% (20,000B) (heap allocation functions) malloc/new/new[], –alloc-fns, etc. ->49.74% (10,000B) 0x804841A: main (example.c:20) | ->39.79% (8,000B) 0x80483C2: g (example.c:5) | ->19.90% (4,000B) 0x80483E2: f (example.c:11) | | ->19.90% (4,000B) 0x8048431: main (example.c:23) | | | ->19.90% (4,000B) 0x8048436: main (example.c:25) | ->09.95% … Read more

How to combine 2 plots (ggplot) into one plot?

Creating a single combined plot with your current data set up would look something like this p <- ggplot() + # blue plot geom_point(data=visual1, aes(x=ISSUE_DATE, y=COUNTED)) + geom_smooth(data=visual1, aes(x=ISSUE_DATE, y=COUNTED), fill=”blue”, colour=”darkblue”, size=1) + # red plot geom_point(data=visual2, aes(x=ISSUE_DATE, y=COUNTED)) + geom_smooth(data=visual2, aes(x=ISSUE_DATE, y=COUNTED), fill=”red”, colour=”red”, size=1) however if you could combine the data sets … Read more

How to write a web-based music visualizer?

Making something audio reactive is pretty simple. Here’s an open source site with lots audio reactive examples. As for how to do it you basically use the Web Audio API to stream the music and use its AnalyserNode to get audio data out. “use strict”; const ctx = document.querySelector(“canvas”).getContext(“2d”); ctx.fillText(“click to start”, 100, 75); ctx.canvas.addEventListener(‘click’, … Read more