The following project arose from two interests of mine:

  1. I wrote a «review» of my own output on Iron Noder in the time of Plague, based mostly on things that no one can «see». By that I mean that I didn’t want to judge my own writeups by the classical measures of a review (mastery over the use of language, value of objective facts, value of subjective emotions, et cetera) but on my own terms to help me analyze how and why I write the way I write. The end result is that I judged myself on two orthogonal categories: How easy it felt to write, and how much fun—for a nerd’s definition of fun—it was to write. The end result is interesting and revealing to me
  2. I love the general concept of categorizing arbitrary things on arbitrary scales FOR FUN. This SMBC chart is a good example. However, for such a chart to be functional, my inner scientist needs reminding everyone that the categories in question must be statistically orthogonal to each other. That is, the categories should, in principle, be completely or mostly not correlated to each other. Thus, in principle one could encounter examples of the thing all quadrants.

So I decided to se if I could categorize my own writeups using the above principles and convert them to an e2-friendly visualization. Behold!

You can find the source code below (I’ll try updating it here, but the latest version should always be on my Github). If you have python installed you can play with it and generate your own chart yourself. But you’ll need to do some work on your own

Use

  1. Check that you have Python 3.x installed

  2. Download the following code and save it as something like nodegel_like_graph.csv

  3. Create a new plain text file.

  4. The first line should be title,x,y, exactly like that.

  5. For every writeup that you want in the chart, begin a new line. The lines must follow this format:

    Writeup title, x, y

    In other words, write the following in order:

    • Node title (if the title has a comma in it, surround the whole thing by double-quotes like so: “Spam, spam, spam”
    • A comma
    • An integer value representing the first thing you want to measure
    • A comma
    • Another integer value representing the second thing you want to measure
  6. Save the file as nodegel_like_graph.csv on the same folder where you saved the code. The extension is important so that it can be correctly read by the program. DO NOT save it as nodegel_like_graph.txt or it will be overwritten!

  7. On your console run python nodegel_like_graph.csv

  8. ???

  9. PROFIT! You should have a shiny new file called nodegel_like_graph.txt that you can copy and paste it on your homenode! Or in a daylog! The file has extension .txt but it’s formatted in HTML.

Things you can—and probably want to—customize

  • I want to change the axis title!“: You can do that directly on the output file. If you want to alter it on the source code for future runs, look for and change the values for the variables xtitle and ytitle
  • I want to change the character used to represent a writeup!: Look for and change the variable linkchar
  • I want to change the dimensions of the output!: Look for and change the variables xmeasure and ymeasure. Be warned, though: the output uses fixed-width characters which itself are non-square, so even if you write the measures to be 160 and 90 that doesn’t mean you’ll get a 16:9 figure

Example file

Save this as nodegel_like_graph.csv

title,x,y
Statements that would be shocking to people living in 1975, 50, 85
Overview of Final Fantasy, 15, 99
The Wellerdrone, 10, 40
Sometimes I deal with depression by baking bread, 10, 15
"Abandoned, Forgotten, Forgiven, and Forbidden pieces in Chess", 80, 40
Word Enchilada S01E02, 99, 10

Example output


|                                                                               
|         X                                                                     
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                     X                                         
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|     X                                                       X                 
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|                                                                               
|     X                                                                         
|                                                                               
|                                                                             X 
|                                                                               
+-------------------------------------------------------------------------------

X-axis represents Ease of writing (positive to the right)
Y-axis represents Fun of writing (positive upwards)
Horizontal scale goes from 10 to 99 Vertical scale goes from 10 to 99

FAQs

Can I use any values I want?
You can—the program stretches and squeezes so that proportions are kept… mostly. I advise you using numbers between 0 and 100 and maybe even between -1000 and 1000; but feel free to include other scales as you see fit.
Is this mathematically exact?
Not really. This program stretches and squeezes your chosen scale to the values set by xmeasure and ymeasure, which means it converts the scales to integers, so expect a fair bit of quantization errors

The Code

# -*- coding: utf-8 -*-
"""
Created on Wed Mar  9 16:16:39 2022

@author: Andy

License: GNU General Public License v3.0
"""

import pandas as pd

# Axis titles, change them at will
xtitle = "Ease of writing"
ytitle = "Fun of writing"
linkchar = 'X'

# Longest dimension of output, make them even for sanity's sake.
xmeasure = 80
ymeasure = 40

# Don't change these
startstr = "<small><pre></code>\n"
endstr = "</code></pre></small>\n\n"


# Get the data
df = pd.read_csv('nodegel_like_graph.csv', encoding='utf8')


# Values to normalize
_, xmin, ymin = df.min(axis=0)
_, xmax, ymax = df.max(axis=0)

# Normalizing constants
if xmin < 0:
    xfact = (xmeasure - 2) / (2 * xmax)
else:
    xfact = (xmeasure - 1) / xmax

if xmin < 0:
    yfact = (ymeasure - 2) / (2 * ymax)
else:
    yfact = (ymeasure - 1) / ymax

# Create basic text lines
# I suppose these could be altered
outrow = '|' + (' ' * (xmeasure - 1))
outaxis = '+' + ('-' * (xmeasure - 1))

# Normalize as ints
# Also create offsets so counting is easier as a list of strings
df['x1'] = ((df['x'] * xfact)).astype(int)
df['xoff'] = (xmeasure - df['x1']) * -1
df['y1'] = (df['y'] * yfact).astype(int)
df['yoff'] = (ymeasure - df['y1'])

# Sort table by new y-value, descending
df.sort_values(by=['y1', 'x1'], ascending=True, inplace=True)
#print(df)  # To test

# Prepare blank list of strings to export
outlist = []
for i in range(ymeasure, 0, -1):
    if i == 1:
        outlist.append(outaxis)
    else:
        outlist.append(outrow)

# Get offset coordinates and modify
for row in df.itertuples(name=None):
    mody = row[-1]
    modx = row[-3]
    modtitle = row[1]
    newstr = outlist[mody][:(modx - 1)] + '<b>[' + modtitle + '|' + linkchar + ']</b>' + outlist[mody][modx:]
    outlist[mody] = newstr

# Prepare explanation lines
legend = ('<p>X-axis represents <b>' + xtitle + '</b> (positive to the right)<br/>\n' +
         'Y-axis represents <b>' + ytitle + '</b> (positive upwards)<br/>\n' +
         'Horizontal scale goes from ' + str(xmin) + ' to ' + str(xmax) + '<br/>\n' +
         'Vertical scale goes from ' + str(ymin) + ' to ' + str(ymax) +
         '</p>')

with open('nodegel_like_graph.txt', mode='w') as outfile:
    outfile.write(startstr)
    for line in outlist:
        outfile.write(line)
        outfile.write('\n')
    outfile.write(endstr)
    outfile.write(legend)

Log in or register to write something here or to contact authors.