Skip to content

Instantly share code, notes, and snippets.

@correl
Created June 11, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save correl/496e81fa2ed01e0210253372da8f2fd1 to your computer and use it in GitHub Desktop.
Save correl/496e81fa2ed01e0210253372da8f2fd1 to your computer and use it in GitHub Desktop.
Graphing gender expression in my org-mode journal
* Graphs
** Gender Expression
#+name: mtf
#+BEGIN_SRC emacs-lisp :exports none :results silent
(->>
(org-map-entries
(lambda ()
(list (car (s-split " " (org-no-properties (org-get-heading t t t t))))
(--if-let (org-entry-get (point) "MTF")
(string-to-number it))
(--if-let (org-entry-get (point) "Outfit")
(s-split " " it)))))
(-filter (lambda (x) (= 10 (length (car x))))))
#+END_SRC
#+BEGIN_SRC python :var data=mtf :var filename="journal-gender-expression.png" :results file :exports results
from datetime import datetime
import matplotlib
matplotlib.use('SVG')
import matplotlib.pyplot as plt
import pandas as pd
data = [{'date': datetime.strptime(date, '%Y-%m-%d'),
'mtf': mtf or None,
'outfit': outfit}
for date, mtf, outfit in data]
data = pd.DataFrame(data).set_index('date')
mtf = pd.Series(data[data['mtf'] > 0]['mtf'] - 3)
hasboobs = data['outfit'].apply(lambda x: 'boobs' in x)
boobs = pd.Series(data[hasboobs]['mtf'] - 3)
fig, ax = plt.subplots()
ax.set_title('Gender Expression Over Time')
mtf.plot(ax=ax, ylim=(-2, 2), yticks=[2, 0, -2], color='mediumpurple', label='Gender')
boobs.plot(ax=ax, marker='o', linewidth=0, color='hotpink', label='Boobs')
ax.set_yticklabels(['F', 'A', 'M'])
ax.axhspan(-2, 0, alpha=0.3, color='lightblue')
ax.axhspan(0, 2, alpha=0.3, color='pink')
ax.legend()
plt.savefig(filename)
return filename
#+END_SRC
#+RESULTS:
[[file:journal-gender-expression.png]]
* 2018
** 2018-06 June
*** 2018-06-09 Saturday
:PROPERTIES:
:MTF: 5
:Outfit: boobs top tight-jeans sandals makeup
:END:
[2018-06-09 Sat 21:22]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla in
libero nunc. Cras quis condimentum sem. Suspendisse suscipit tortor
sed gravida consequat. Nullam nisl est, mollis quis pharetra vel,
cursus accumsan ante. Nullam ut turpis velit. Vivamus tortor purus,
tristique vel massa in, vehicula luctus eros. Praesent congue sit amet
mauris nec faucibus. Aliquam erat volutpat. Donec sit amet cursus
lectus, sit amet commodo lacus.
Interdum et malesuada fames ac ante ipsum primis in faucibus. In
ultrices risus nec vestibulum dapibus. Vestibulum leo tellus, semper
id vestibulum nec, ullamcorper in sem. Vivamus at erat vel libero
elementum hendrerit et posuere ex. Aenean sit amet sem felis. Lorem
ipsum dolor sit amet, consectetur adipiscing elit. Nullam vel elit ut
arcu venenatis efficitur. Mauris iaculis, elit quis semper semper,
massa erat ultricies metus, non lacinia sapien quam nec odio. Mauris a
nisl sed velit pellentesque lacinia. Maecenas rutrum fermentum
vestibulum. Pellentesque non fermentum elit, et elementum nunc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment