emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* gnuplot: plotting students' progress of grades
@ 2015-08-31 22:42 Tobias Frischholz
  2015-09-01  6:38 ` Robert Klein
  2015-09-01  6:59 ` Loris Bennett
  0 siblings, 2 replies; 5+ messages in thread
From: Tobias Frischholz @ 2015-08-31 22:42 UTC (permalink / raw)
  To: Org Mode Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1483 bytes --]

Hi List,

I have a table in org which looks like this (student’s grades):

|---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
|   | Schüler    | 1-fach | 1-fach | 1-fach | 1-fach | 2-fach | 2-fach | 2-fach | 2-fach | 4-fach | 4-fach | 4-fach | 4-fach | Endnote |
|---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
| # | Wurm, Hans |      4 |      3 |      2 |      3 |      3 |        |      3 |      1 |      3 |        |      3 |      5 |    3.18 |
| # | Igel, Sepp |      1 |      2 |      3 |      3 |        |        |        |      3 |      2 |        |      3 |      6 |    3.28 |
|---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
| # | \o         |   2.50 |   2.50 |   2.50 |   3.00 |   3.00 |   0.00 |   3.00 |   2.00 |   2.50 |   0.00 |   3.00 |   5.50 |    3.23 |
|---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+————|

I would like to use gnuplot to show me a line graph of each student’s single grades in order to resemble their progress during the school year.
Can this be achieved with it?

Best regards,
Tobias Frischholz

PGP PUBLIC KEY: http://pgp.mit.edu/pks/lookup?search=0xCD463AC1&op=index


[-- Attachment #1.2: Type: text/html, Size: 3111 bytes --]

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gnuplot: plotting students' progress of grades
  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  6:59 ` Loris Bennett
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Klein @ 2015-09-01  6:38 UTC (permalink / raw)
  To: Tobias Frischholz; +Cc: Org Mode Mailing List

Hi,

Tobias Frischholz <tobias@friolz.com> wrote:

> Hi List,
> 
> I have a table in org which looks like this (student’s grades):
> 
  [s.d.]
> I would like to use gnuplot to show me a line graph of each student’s
> single grades in order to resemble their progress during the school
> year. Can this be achieved with it?
> 

You can use something like this:

#+Name: grades
|---+------------+--------+--------+--------+------|
|   | Schüler    | 1-fach | 1-fach | 1-fach | note |
|---+------------+--------+--------+--------+------|
| # | Wurm, Hans |      4 |      3 |      2 | 3.18 |
| # | Igel, Sepp |      1 |      2 |      3 | 3.28 |
|---+------------+--------+--------+--------+------|
| # | \o         |   2.50 |   2.50 |   2.50 | 3.23 |
|---+------------+--------+--------+--------+------|

#+begin_src gnuplot :var data=grades :file noten.png
  put your gnuplot code here
#+end_src

Please see the worg page
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html
for more information.

Best regards
Robert



> Best regards,
> Tobias Frischholz
> 
> PGP PUBLIC KEY:
> http://pgp.mit.edu/pks/lookup?search=0xCD463AC1&op=index
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gnuplot: plotting students' progress of grades
  2015-08-31 22:42 gnuplot: plotting students' progress of grades Tobias Frischholz
  2015-09-01  6:38 ` Robert Klein
@ 2015-09-01  6:59 ` Loris Bennett
  1 sibling, 0 replies; 5+ messages in thread
From: Loris Bennett @ 2015-09-01  6:59 UTC (permalink / raw)
  To: emacs-orgmode

Hi Tobias,

Tobias Frischholz <tobias@friolz.com> writes:

> Hi List,
>
> I have a table in org which looks like this (student’s grades):
>
> |---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
> | | Schüler | 1-fach | 1-fach | 1-fach | 1-fach | 2-fach | 2-fach | 2-fach |
> 2-fach | 4-fach | 4-fach | 4-fach | 4-fach | Endnote |
> |---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
> | # | Wurm, Hans | 4 | 3 | 2 | 3 | 3 | | 3 | 1 | 3 | | 3 | 5 | 3.18 |
> | # | Igel, Sepp | 1 | 2 | 3 | 3 | | | | 3 | 2 | | 3 | 6 | 3.28 |
> |---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
> | # | \o | 2.50 | 2.50 | 2.50 | 3.00 | 3.00 | 0.00 | 3.00 | 2.00 | 2.50 | 0.00 |
> 3.00 | 5.50 | 3.23 |
> |---+------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+————|
>
> I would like to use gnuplot to show me a line graph of each student’s single
> grades in order to resemble their progress during the school year.
> Can this be achieved with it?
>
> Best regards,
> Tobias Frischholz
>
> PGP PUBLIC KEY: http://pgp.mit.edu/pks/lookup?search=0xCD463AC1&op=index

I haven't used gnuplot for a couple of decades and in recent years have
used R with org for this sort of thing, but I'm sure it's possible

Have you looked at

http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html

?

Cheers,

Loris

-- 
This signature is currently under construction.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gnuplot: plotting students' progress of grades
  2015-09-01  6:38 ` Robert Klein
@ 2015-09-01 10:51   ` Eric S Fraga
  2015-09-01 12:35     ` John Kitchin
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2015-09-01 10:51 UTC (permalink / raw)
  To: Robert Klein; +Cc: Org Mode Mailing List, Tobias Frischholz

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 ;-).

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-176-g45abec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gnuplot: plotting students' progress of grades
  2015-09-01 10:51   ` Eric S Fraga
@ 2015-09-01 12:35     ` John Kitchin
  0 siblings, 0 replies; 5+ messages in thread
From: John Kitchin @ 2015-09-01 12:35 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Org Mode Mailing List, Robert Klein, Tobias Frischholz

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-01 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-09-01  6:59 ` Loris Bennett

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).