Org Mode Python Plotting and Return values

Testing out some python code blocks in org babel. See http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html

import matplotlib, numpy
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)
plt.plot(numpy.sin(x)/x)
fig.tight_layout()
plt.savefig('python-matplot-fig.png')
return 'python-matplot-fig.png' # return filename to org-mode
Sample plot

Sample plot

def foo(x):
    bar=[1,2,3]
    baz=42
    qux=[[1,2,3],[4,5,6]]

    if x>0:
        return bar

    else:
        return qux

return foo(-5)
1 2 3
4 5 6
Advertisements

Org Mode Table Sorting

  • hit C-c ^
  • key is there has to be horizontal lines before and after.
  • it sorts on column you are on
  • Understands basic times (hh:mm)
  • Understands org-ish dates <2015-07-04 Sat>
  • Does not understand numbers with commas
Name Phone Age Time Date
Peter 1234 17 2:00  
Anna 4321 25 1:00  
Mary 0124 45 6:00  
Mary 0124 45 6:00 <2015-07-01 Wed>
Peter 1234 17 2:00 <2015-07-03 Fri>
Anna 4321 25 1:00 <2015-07-04 Sat>

See:

Posting a subtree in org2blog

I was wondering how to post a subtree in org2blog for a while, and the answer is right there. I just needed to take the time to Read The Fine Manual:

https://github.com/punchagan/org2blog/

Use M-x org2blog/wp-post-subtree.

Tags of the subtree will be used for tags.

Other properties can be set using a property drawer. The properties use the same names as the buffer variables.

POST_DATE sets the date to be used for the post. If it is not present, SCHEDULED, DEADLINE or any other active or inactive time-stamps are used.