* plotting a transposed table
@ 2014-03-18 16:43 hubert
2014-03-18 17:44 ` Thomas S. Dye
0 siblings, 1 reply; 3+ messages in thread
From: hubert @ 2014-03-18 16:43 UTC (permalink / raw)
To: emacs-orgmode
I have a table where the data runs left-to-right instead of
top-to-bottom. For example:
| year | 2014 | 2015 | 2016 | 2017 | 2018 |
| value | 1 | 2 | 3 | 4 | 5 |
Gnuplot expects the data to be top-to-bottom, but I want to keep the
table in that format. I know that I could write an external script
create a transposed copy of the table, but I was wondering if there was
an easier way to plot the data.
--
Hubert Chathi - Email/Jabber: hubert@uhoreg.ca - http://www.uhoreg.ca/
PGP/GnuPG key: 4096R/113A1368 (Key available at pool.sks-keyservers.net)
Fingerprint: F24C F749 6C73 DDB8 DCB8 72DE B2DE 88D3 113A 1368
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: plotting a transposed table
2014-03-18 16:43 plotting a transposed table hubert
@ 2014-03-18 17:44 ` Thomas S. Dye
2014-03-18 18:19 ` hubert
0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2014-03-18 17:44 UTC (permalink / raw)
To: hubert; +Cc: emacs-orgmode
Aloha hubert,
Could you use the transpose function in the Library of Babel?
#+name: transpose-example
| 1 | 2 | 3 |
| 4 | 5 | 6 |
#+name: transpose
#+begin_src emacs-lisp :var table=transpose-example
(apply #'mapcar* #'list table)
#+end_src
#+results: transpose
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
All the best,
Tom
hubert <hubert@uhoreg.ca> writes:
> I have a table where the data runs left-to-right instead of
> top-to-bottom. For example:
>
> | year | 2014 | 2015 | 2016 | 2017 | 2018 |
> | value | 1 | 2 | 3 | 4 | 5 |
>
> Gnuplot expects the data to be top-to-bottom, but I want to keep the
> table in that format. I know that I could write an external script
> create a transposed copy of the table, but I was wondering if there was
> an easier way to plot the data.
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: plotting a transposed table
2014-03-18 17:44 ` Thomas S. Dye
@ 2014-03-18 18:19 ` hubert
0 siblings, 0 replies; 3+ messages in thread
From: hubert @ 2014-03-18 18:19 UTC (permalink / raw)
To: emacs-orgmode
On Tue, 18 Mar 2014 07:44:20 -1000, tsd@tsdye.com (Thomas S. Dye) said:
[...]
> #+name: transpose
> #+begin_src emacs-lisp :var table=transpose-example
> (apply #'mapcar* #'list table)
> #+end_src
Thanks. That works, except that hlines in the table confuse it, so I
modified it as below (using --filter from dash.el).
#+name: transpose
#+begin_src emacs-lisp :var table=plans
(apply #'mapcar* #'list (--filter (not (eq 'hline it)) table))
#+end_src
A solution that doesn't require an intermediate table would be ideal,
but this is usable.
--
Hubert Chathi - Email/Jabber: hubert@uhoreg.ca - http://www.uhoreg.ca/
PGP/GnuPG key: 4096R/113A1368 (Key available at pool.sks-keyservers.net)
Fingerprint: F24C F749 6C73 DDB8 DCB8 72DE B2DE 88D3 113A 1368
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-18 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 16:43 plotting a transposed table hubert
2014-03-18 17:44 ` Thomas S. Dye
2014-03-18 18:19 ` hubert
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.