From: Nick Dokos <nicholas.dokos@hp.com>
To: Major A <andras.g.major@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table
Date: Mon, 29 Aug 2011 05:05:20 -0400 [thread overview]
Message-ID: <26064.1314608720@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Major A <andras.g.major@gmail.com> of "Mon\, 29 Aug 2011 10\:00\:05 +0200." <20110829080003.GA12790@discus>
[-- Attachment #1: Type: text/plain, Size: 2679 bytes --]
Major A <andras.g.major@gmail.com> wrote:
>
> Hi,
>
> I'd like to use asymptote to plot the values in an Org table. The table
> has cells with numbers but also cells with strings in them. This table
> gets converted to an array of strings in the resulting asymptote file,
> with the strings escaped with double-quotes but not the numbers. In
> asymptote, this is an error, so that no plot is produced.
>
> Here's the code:
>
> #+data: values
> | 0 | 0 | a |
> | 1 | 1 | b |
> | 2 | 3 | c |
> =20
> #+begin_src asymptote :file asy.png :var v=3Dvalues
> size(100);
> draw((0,0)--(1,1));
> #+end_src
>
> The temporary asymptote file created during evaluation or export looks
> like this:
>
> string[][] v=3D{
> {0,0,"a"},
> {1,1,"b"},
> {2,3,"c"}
> };
>
> "asy" complains about this file like this:
>
> asymptote-12652XAo: 2.2: cannot cast 'int' to 'string'
> asymptote-12652XAo: 2.4: cannot cast 'int' to 'string'
> asymptote-12652XAo: 3.2: cannot cast 'int' to 'string'
> asymptote-12652XAo: 3.4: cannot cast 'int' to 'string'
> asymptote-12652XAo: 4.2: cannot cast 'int' to 'string'
> asymptote-12652XAo: 4.4: cannot cast 'int' to 'string'
>
> Am I doing something wrong here?
>
I don't know anything about asymptote and I am not sure whether this
will help: it does produce a temp file with everything quoted and
running asy on the temp file produces an .eps file that contains the
diagonal line, but it produces a png file which seems somewhat peculiar
to me but maybe it'll work for you.
You have to do
(setq org-babel-min-lines-for-block-output 0)
in order to get the example block result.
I just added a python block to produce another table with everything
quoted. The second table is then give to asymptote:
--8<---------------cut here---------------start------------->8---
#+data: values
| 0 | 0 | a |
| 1 | 1 | b |
| 2 | 3 | c |
#+begin_src python :results output :var table=values
print "#+data: qvalues"
for row in table:
print "|%s|" % ("|".join(map(lambda x: "\"%s\"" % (x), row)))
#+end_src
#+results:
#+begin_example
#+data: qvalues
|"0"|"0"|"a"|
|"1"|"1"|"b"|
|"2"|"3"|"c"|
#+end_example
#+begin_src asymptote :file asy.png :var v=qvalues
size(100);
draw((0,0)--(1,1));
#+end_src
#+results:
[[file:asy.png]]
--8<---------------cut here---------------end--------------->8---
The temp file looks like this:
--8<---------------cut here---------------start------------->8---
string[][] v={
{"0","0","a"},
{"1","1","b"},
{"2","3","c"}
};
size(100);
draw((0,0)--(1,1));
--8<---------------cut here---------------end--------------->8---
I attach the asy.png file I get.
Nick
[-- Attachment #2: asy.png --]
[-- Type: image/png, Size: 680 bytes --]
next prev parent reply other threads:[~2011-08-29 9:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-29 8:00 Bug: Babel: asymptote: erroneous conversion of heterogeneous-typed table Major A
2011-08-29 8:47 ` Nicolas Goaziou
2011-08-29 9:12 ` András Major
2011-08-29 9:50 ` Nicolas Goaziou
2011-08-29 10:42 ` András Major
2011-08-29 12:50 ` Nicolas Goaziou
2011-08-29 16:35 ` Nicolas Goaziou
2011-08-29 16:52 ` Eric Schulte
2011-08-29 17:27 ` Nicolas Goaziou
2011-08-29 18:02 ` Eric Schulte
2011-08-29 18:50 ` András Major
2011-08-29 19:02 ` Eric Schulte
2011-08-29 19:11 ` Nick Dokos
2011-08-30 19:12 ` András Major
2011-08-30 19:34 ` Eric Schulte
2011-08-30 20:45 ` András Major
2011-08-30 20:55 ` Eric Schulte
2011-08-31 6:48 ` András Major
2011-08-31 8:17 ` Nick Dokos
2011-08-31 9:35 ` Nicolas Goaziou
2011-08-31 12:14 ` Eric Schulte
2011-08-29 9:05 ` Nick Dokos [this message]
2011-08-29 9:40 ` András Major
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
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=26064.1314608720@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=andras.g.major@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 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).