emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Sharing variables between source blocks without session
Date: Tue, 16 Mar 2021 09:56:13 +0100	[thread overview]
Message-ID: <87o8fjscia.fsf@hornfels.zedat.fu-berlin.de> (raw)


I have a 'sh' source block which produces a table which I then want to
plot with a 'python' source block:

#+NAME: code;raw_data
#+HEADER: :var user="loris"
  ps -u loris -o etimes=

#+NAME: tab;raw_data
#+RESULTS: code;raw_data...

#+HEADER: :var df=tab;raw_data
#+HEADER: :var user="loris"
#+BEGIN_SRC python :results file :var f="process_times.pdf"
  import numpy as np
  import matplotlib.pyplot as plt
  # flatten list
  x = [item for sublist in df for item in sublist]
  plt.hist(x, bins=10)
  plt.xlabel("time [s]")
  plt.ylabel("number of processes")
  plt.title("user: " + user)
  return f

How can I avoid having to declare the variable 'user' for both blocks?



This signature is currently under construction.

             reply	other threads:[~2021-03-16  8:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16  8:56 Loris Bennett [this message]
2021-03-16  9:16 ` Sharing variables between source blocks without session Loris Bennett
2021-03-16 13:28 ` Eric S Fraga
2021-03-18 13:21   ` Loris Bennett
2021-03-18 15:56     ` Eric S Fraga
2021-03-19  6:50       ` Loris Bennett
2021-03-18 17:59     ` Cook, Malcolm
2021-03-19  6:38       ` Loris Bennett
2021-03-19  7:04         ` Loris Bennett
2021-03-19 13:26         ` Eric S Fraga
2021-03-19 13:59           ` Loris Bennett
2021-03-19 14:26             ` Eric S Fraga
2021-03-22  7:39               ` Loris Bennett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8fjscia.fsf@hornfels.zedat.fu-berlin.de \
    --to=loris.bennett@fu-berlin.de \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).