From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>,
Robert Klein <roklein@roklein.de>,
Tobias Frischholz <tobias@friolz.com>
Subject: Re: gnuplot: plotting students' progress of grades
Date: Tue, 01 Sep 2015 08:35:19 -0400 [thread overview]
Message-ID: <m21teifhbs.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <87d1y2ifah.fsf@ucl.ac.uk>
You can transpose the table like this:
(org-table-transpose-table-at-point)
Alternatively (adapted from that code): this might get you where you
need to be:
#+name: my-data
| 1 | 2 | 3 | 4 |
| a | b | c | d |
#+BEGIN_SRC emacs-lisp
(defun get-transposed-table (tblname)
(save-excursion
(org-open-link-from-string (format "[[%s]]" tblname))
(while (not (org-table-p))
(forward-line))
(let* ((table (delete 'hline (org-table-to-lisp)))
(contents (mapcar (lambda (p)
(let ((tp table))
(mapcar
(lambda (rown)
(prog1
(pop (car tp))
(setq tp (cdr tp))))
table)))
(car table))))
(mapconcat (lambda(x) (concat "| " (mapconcat 'identity x " | " ) " |\n" ))
contents ""))))
#+END_SRC
#+RESULTS:
: get-transposed-table
#+BEGIN_SRC python :var data=(get-transposed-table "my-data")
print data
#+END_SRC
#+RESULTS:
: | 1 | a |
: | 2 | b |
: | 3 | c |
: | 4 | d |
:
Eric S Fraga writes:
> On Tuesday, 1 Sep 2015 at 08:38, Robert Klein wrote:
>
> [...]
>
>> You can use something like this:
>
> [...]
>
>> #+begin_src gnuplot :var data=grades :file noten.png
>> put your gnuplot code here
>> #+end_src
>
> The problem for the OP will be that the data are in rows instead of
> columns and gnuplot will only plot columns (selected using
> "using"). The table needs to be transposed first (which is possible but
> don't ask me how ;-).
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
next prev parent reply other threads:[~2015-09-01 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 22:42 gnuplot: plotting students' progress of grades Tobias Frischholz
2015-09-01 6:38 ` Robert Klein
2015-09-01 10:51 ` Eric S Fraga
2015-09-01 12:35 ` John Kitchin [this message]
2015-09-01 6:59 ` 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m21teifhbs.fsf@andrew.cmu.edu \
--to=jkitchin@andrew.cmu.edu \
--cc=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=roklein@roklein.de \
--cc=tobias@friolz.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.