* babel, matlab export plot to png fails @ 2017-08-13 8:33 Uwe Brauer 2017-08-13 14:30 ` John Kitchin 2017-08-15 9:12 ` Neil Jerram 0 siblings, 2 replies; 17+ messages in thread From: Uwe Brauer @ 2017-08-13 8:33 UTC (permalink / raw) To: emacs-orgmode Hi I would like to execute some matlab code in org file (using GNU emacs 26 and the git version of org mode) and save the result of the plot command in a png file, so I tried #+begin_src matlab :session :exports both :file testplot.png t=[0:0.1:1]; y=sin(t); plot(t,y) print -dpng testplot.png #+end_src And also #+begin_src matlab :results output latex :exports results :file testplot.png t=[0:0.1:1]; y=sin(t); plot(t,y) print -dpng testplot.png #+end_src But the resulting png files are corrupt. I presume also the matlab commands are included in the png file which is not correct. But I don't know who to achieve that just the last command is saved in a png file. I googled without success. Does somebody know the correct syntax? Thanks Uwe Brauer ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-13 8:33 babel, matlab export plot to png fails Uwe Brauer @ 2017-08-13 14:30 ` John Kitchin 2017-08-16 12:26 ` Uwe Brauer 2017-08-15 9:12 ` Neil Jerram 1 sibling, 1 reply; 17+ messages in thread From: John Kitchin @ 2017-08-13 14:30 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1263 bytes --] You need to get the contents of the png to get output. Maybe the type command will do that. E.g. Add as the last line: type testplot.png On Sun, Aug 13, 2017 at 1:34 AM Uwe Brauer <oub@mat.ucm.es> wrote: > > Hi > > I would like to execute some matlab code in org file (using GNU emacs 26 > and the git version of org mode) and save the result of the plot command > in a png file, so I tried > > #+begin_src matlab :session :exports both :file testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > And also > #+begin_src matlab :results output latex :exports results :file > testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > But the resulting png files are corrupt. I presume also the matlab > commands are included in the png file which is not correct. But I don't > know who to achieve that just the last command is saved in a png file. > > I googled without success. Does somebody know the correct syntax? > > Thanks > > Uwe Brauer > > > -- John ----------------------------------- 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 [-- Attachment #2: Type: text/html, Size: 1950 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-13 14:30 ` John Kitchin @ 2017-08-16 12:26 ` Uwe Brauer 0 siblings, 0 replies; 17+ messages in thread From: Uwe Brauer @ 2017-08-16 12:26 UTC (permalink / raw) To: emacs-orgmode >>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes: > You need to get the contents of the png to get output. Maybe the type > command will do that. E.g. Add as the last line: > type testplot.png Thanks but this did not work, neither. Uwe ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-13 8:33 babel, matlab export plot to png fails Uwe Brauer 2017-08-13 14:30 ` John Kitchin @ 2017-08-15 9:12 ` Neil Jerram 2017-08-16 12:28 ` Uwe Brauer 2017-08-16 17:25 ` Berry, Charles 1 sibling, 2 replies; 17+ messages in thread From: Neil Jerram @ 2017-08-15 9:12 UTC (permalink / raw) To: emacs-orgmode On 13/08/17 10:33, Uwe Brauer wrote: > Hi > > I would like to execute some matlab code in org file (using GNU emacs 26 > and the git version of org mode) and save the result of the plot command > in a png file, so I tried > > #+begin_src matlab :session :exports both :file testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > And also > #+begin_src matlab :results output latex :exports results :file testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > But the resulting png files are corrupt. I presume also the matlab > commands are included in the png file which is not correct. But I don't > know who to achieve that just the last command is saved in a png file. I guess the problem is that the Matlab line "print -dpng testplot.png" is correctly writing the plot to testplot.png, as you want, but then org-mode is overwriting that file because of the ":file testplot.png". I would try deleting ":file testplot.png". The meaning of ":results output" may be a bit language-dependent - I don't know org-mode well enough to be sure about that yet - but in general I would expect it to consist of the standard output of those commands. So, for example, if you type "print -dpng testplot.png" and Matlab responds with "Generated 'testplot.png'", I would expect ":results output" to contain "Generated 'testplot.png'", not the PNG data. Regards - Neil ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-15 9:12 ` Neil Jerram @ 2017-08-16 12:28 ` Uwe Brauer 2017-08-16 17:25 ` Berry, Charles 1 sibling, 0 replies; 17+ messages in thread From: Uwe Brauer @ 2017-08-16 12:28 UTC (permalink / raw) To: emacs-orgmode > On 13/08/17 10:33, Uwe Brauer wrote: > I guess the problem is that the Matlab line "print -dpng testplot.png" > is correctly writing the plot to testplot.png, as you want, but then > org-mode is overwriting that file because of the ":file testplot.png". > I would try deleting ":file testplot.png". Yes something like this. > The meaning of ":results output" may be a bit language-dependent - I > don't know org-mode well enough to be sure about that yet - but in > general I would expect it to consist of the standard output of those > commands. So, for example, if you type "print -dpng testplot.png" and > Matlab responds with "Generated 'testplot.png'", I would expect > ":results output" to contain "Generated 'testplot.png'", not the PNG > data. What is confusing me is that the testplot.png case does not always contain ascii lines but sometimes is classified as corrupted png. (Using the linux display command, or sometimes just as data using the linux file command) > Regards - Neil ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-15 9:12 ` Neil Jerram 2017-08-16 12:28 ` Uwe Brauer @ 2017-08-16 17:25 ` Berry, Charles 2017-08-16 17:41 ` Eric S Fraga 2017-08-16 21:52 ` Uwe Brauer 1 sibling, 2 replies; 17+ messages in thread From: Berry, Charles @ 2017-08-16 17:25 UTC (permalink / raw) To: Neil Jerram; +Cc: emacs-orgmode@gnu.org > On Aug 15, 2017, at 2:12 AM, Neil Jerram <neil@ossau.homelinux.net> wrote: > > On 13/08/17 10:33, Uwe Brauer wrote: >> Hi >> >> I would like to execute some matlab code in org file (using GNU emacs 26 >> and the git version of org mode) and save the result of the plot command >> in a png file, so I tried >> >> #+begin_src matlab :session :exports both :file testplot.png >> t=[0:0.1:1]; >> y=sin(t); >> plot(t,y) >> print -dpng testplot.png >> #+end_src >> >> And also >> #+begin_src matlab :results output latex :exports results :file testplot.png >> t=[0:0.1:1]; >> y=sin(t); >> plot(t,y) >> print -dpng testplot.png >> #+end_src >> I do not have matlab, but looking at the code in ob-matlab.el and ob-octave.el, it seems that the usual header args should do: : :results graphics :file testplot.png and delete the print statement in the last line. I do not see this documented in (info "(org) results") as it is language specific. Following the page that (info "(org) Languages") points to leads to `http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-octave-matlab.html which looks like it is out-of-date. (Specifically, org-babel-execute:matlab calls org-babel-execute:octave which *now* sets the result to nil and places the print statement as needed when ~:results graphics~ is specified, but the example will fail under the new regime.) Maybe a link to the Languages worg page should be added in (info "(org) results") and (sigh) maybe the worg pages can be updated to include revision dates? HTH, Chuck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 17:25 ` Berry, Charles @ 2017-08-16 17:41 ` Eric S Fraga 2017-08-16 17:48 ` Berry, Charles 2017-08-16 21:52 ` Uwe Brauer 1 sibling, 1 reply; 17+ messages in thread From: Eric S Fraga @ 2017-08-16 17:41 UTC (permalink / raw) To: Berry, Charles; +Cc: Neil Jerram, emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 394 bytes --] On Wednesday, 16 Aug 2017 at 17:25, Berry, Charles wrote: [...] > I do not have matlab, but looking at the code in ob-matlab.el and > ob-octave.el, it seems that the usual header args should do: > > : :results graphics :file testplot.png This doesn't work for me, at least for octave. What version of org are you using? -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-551-g92e8c8 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 194 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 17:41 ` Eric S Fraga @ 2017-08-16 17:48 ` Berry, Charles 2017-08-16 18:19 ` Eric S Fraga 0 siblings, 1 reply; 17+ messages in thread From: Berry, Charles @ 2017-08-16 17:48 UTC (permalink / raw) To: Eric S Fraga; +Cc: Neil Jerram, emacs-orgmode@gnu.org > On Aug 16, 2017, at 10:41 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > > On Wednesday, 16 Aug 2017 at 17:25, Berry, Charles wrote: > > [...] > >> I do not have matlab, but looking at the code in ob-matlab.el and >> ob-octave.el, it seems that the usual header args should do: >> >> : :results graphics :file testplot.png > > This doesn't work for me, at least for octave. What version of org are > you using? > org 9.0.9 and FWIW, I see this (gfx-file (ignore-errors (org-babel-graphical-output-file params))) (result (org-babel-octave-evaluate session (if gfx-file (mapconcat 'identity (list "set (0, \"defaultfigurevisible\", \"off\");" full-body (format "print -dpng %s" gfx-file)) "\n") full-body) in org-babel-execute:octave Chuck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 17:48 ` Berry, Charles @ 2017-08-16 18:19 ` Eric S Fraga 2017-08-16 18:29 ` Berry, Charles 0 siblings, 1 reply; 17+ messages in thread From: Eric S Fraga @ 2017-08-16 18:19 UTC (permalink / raw) To: Berry, Charles; +Cc: Neil Jerram, emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 536 bytes --] On Wednesday, 16 Aug 2017 at 17:48, Berry, Charles wrote: [...] > org 9.0.9 and FWIW, I see this [...] > in org-babel-execute:octave But I get the following error message from babel/octave: error: invalid call to script /usr/share/octave/4.0.3/m/miscellaneous/ans.m error: evaluating argument list element number 1 Strange. It looks it is expecting to collect the result from the script (ans). What exactly did you use as the src block header? thanks, eric -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-551-g92e8c8 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 194 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 18:19 ` Eric S Fraga @ 2017-08-16 18:29 ` Berry, Charles 0 siblings, 0 replies; 17+ messages in thread From: Berry, Charles @ 2017-08-16 18:29 UTC (permalink / raw) To: Eric S Fraga; +Cc: Neil Jerram, emacs-orgmode@gnu.org > On Aug 16, 2017, at 11:19 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > > On Wednesday, 16 Aug 2017 at 17:48, Berry, Charles wrote: > > [...] > >> org 9.0.9 and FWIW, I see this > > [...] > >> in org-babel-execute:octave > > But I get the following error message from babel/octave: > > error: invalid call to script /usr/share/octave/4.0.3/m/miscellaneous/ans.m > error: evaluating argument list element number 1 > > Strange. It looks it is expecting to collect the result from the script > (ans). What exactly did you use as the src block header? > To be clear, I do not have either matlab or octave. I just glanced at the code and it seemed to do something along the lines of what your posting might have done when instead `:results graphics :file my.png' is given. A critical piece is that org-babel-insert-result needs to have a nil result to avoid overwriting the file given in `:file my.png' as it seems to do for Neil. I didn't see how that would happen for the example you gave. Sorry if this was misdirection. Chuck ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 17:25 ` Berry, Charles 2017-08-16 17:41 ` Eric S Fraga @ 2017-08-16 21:52 ` Uwe Brauer 1 sibling, 0 replies; 17+ messages in thread From: Uwe Brauer @ 2017-08-16 21:52 UTC (permalink / raw) To: emacs-orgmode > I do not have matlab, but looking at the code in ob-matlab.el and > ob-octave.el, it seems that the usual header args should do: > : :results graphics :file testplot.png > and delete the print statement in the last line. I just tried it, results in an empty png file. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <35e27070f72a4368bdf61b972ddef4c6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>]
* Re: babel, matlab export plot to png fails [not found] <35e27070f72a4368bdf61b972ddef4c6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> @ 2017-08-15 17:21 ` Eric S Fraga 2017-08-16 12:33 ` Uwe Brauer [not found] ` <53741190f80c4e229a9c7f55cf46f1e6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> 0 siblings, 2 replies; 17+ messages in thread From: Eric S Fraga @ 2017-08-15 17:21 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 661 bytes --] On Sunday, 13 Aug 2017 at 08:33, Uwe Brauer wrote: > I would like to execute some matlab code in org file (using GNU emacs 26 > and the git version of org mode) and save the result of the plot command > in a png file, so I tried [...] > #+begin_src matlab :results output latex :exports results :file testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src Maybe try with ":results file" instead of "output latex"? Works for octave (I don't have MATLAB). That is: #+begin_src matlab :results file :exports results :file testplot.png ... #+end_src -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-551-g92e8c8 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 194 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-15 17:21 ` Eric S Fraga @ 2017-08-16 12:33 ` Uwe Brauer 2017-08-16 17:10 ` Eric S Fraga [not found] ` <53741190f80c4e229a9c7f55cf46f1e6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> 1 sibling, 1 reply; 17+ messages in thread From: Uwe Brauer @ 2017-08-16 12:33 UTC (permalink / raw) To: emacs-orgmode >>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Sunday, 13 Aug 2017 at 08:33, Uwe Brauer wrote: >> I would like to execute some matlab code in org file (using GNU emacs 26 >> and the git version of org mode) and save the result of the plot command >> in a png file, so I tried > [...] >> #+begin_src matlab :results output latex :exports results :file testplot.png >> t=[0:0.1:1]; >> y=sin(t); >> plot(t,y) >> print -dpng testplot.png >> #+end_src > Maybe try with ":results file" instead of "output latex"? Works for > octave (I don't have MATLAB). That is: > #+begin_src matlab :results file :exports results :file testplot.png > ... > #+end_src In that case testplot.png contains zero bytes. BTW Eric, thanks for your reply, but a lot of your posts seem to be outside the thread, at least when I read them via gnus or thunderbird. Not sure who is the culprit..... It makes reading it a bit difficult. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 12:33 ` Uwe Brauer @ 2017-08-16 17:10 ` Eric S Fraga 2017-08-17 15:09 ` Uwe Brauer 0 siblings, 1 reply; 17+ messages in thread From: Eric S Fraga @ 2017-08-16 17:10 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 353 bytes --] On Wednesday, 16 Aug 2017 at 12:33, Uwe Brauer wrote: [...] > BTW Eric, thanks for your reply, but a lot of your posts seem to be > outside the thread, at least when I read them via gnus or thunderbird. > Not sure who is the culprit..... Does this one thread better? Thanks, eric -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-551-g92e8c8 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 194 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 17:10 ` Eric S Fraga @ 2017-08-17 15:09 ` Uwe Brauer 0 siblings, 0 replies; 17+ messages in thread From: Uwe Brauer @ 2017-08-17 15:09 UTC (permalink / raw) To: emacs-orgmode >>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Wednesday, 16 Aug 2017 at 12:33, Uwe Brauer wrote: > [...] >> BTW Eric, thanks for your reply, but a lot of your posts seem to be >> outside the thread, at least when I read them via gnus or thunderbird. >> Not sure who is the culprit..... > Does this one thread better? Definitely! Both in gnus and in thunderbird. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <53741190f80c4e229a9c7f55cf46f1e6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>]
* Re: babel, matlab export plot to png fails [not found] ` <53741190f80c4e229a9c7f55cf46f1e6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> @ 2017-08-16 13:07 ` Eric S Fraga 2017-08-16 14:23 ` Adonay Felipe Nogueira 0 siblings, 1 reply; 17+ messages in thread From: Eric S Fraga @ 2017-08-16 13:07 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 440 bytes --] On Wednesday, 16 Aug 2017 at 12:33, Uwe Brauer wrote: [...] > BTW Eric, thanks for your reply, but a lot of your posts seem to be > outside the thread, at least when I read them via gnus or thunderbird. > Not sure who is the culprit..... > It makes reading it a bit difficult. Interesting and apologies. I'm using gnus and mine seem threaded fine. I'll investigate. -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-551-g92e8c8 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 194 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: babel, matlab export plot to png fails 2017-08-16 13:07 ` Eric S Fraga @ 2017-08-16 14:23 ` Adonay Felipe Nogueira 0 siblings, 0 replies; 17+ messages in thread From: Adonay Felipe Nogueira @ 2017-08-16 14:23 UTC (permalink / raw) To: emacs-orgmode I think I know why, it seems that some email clients ignore the "In-Reply-To" field, and just assume that the reply is in regards to a matching "Subject" field. Mx. Fraga's email messages *do have* have a "Subject" field, however, strangely enough, the subject text doesn't appear in Gnus "Summary" buffer, but the subject does reapear (in the message composition buffer) if one is replying to the mailing list to his messages. Also: I'm also using Gnus, but only Mx. Fraga's have this problem so far. I also have seen other people using Gnus without problems. Don't worry though, it's not that problematic. I would classify it as minor because it can be investigated over time. I *don't* know much about providing email services or hosting, but I guess that the problem is between the email client and the service provider of Mx. Fraga's email address. -- - [[https://libreplanet.org/wiki/User:Adfeno]] - Palestrante e consultor sobre /software/ livre (não confundir com gratis). - "WhatsApp"? Ele não é livre. Por favor, use o GNU Ring ou o Tox. - Contato: [[https://libreplanet.org/wiki/User:Adfeno#vCard]] - Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft Office, MP3, MP4, WMA, WMV. - Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF (apenas sem DRM), PNG, TXT, WEBM. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-08-17 15:09 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-13 8:33 babel, matlab export plot to png fails Uwe Brauer 2017-08-13 14:30 ` John Kitchin 2017-08-16 12:26 ` Uwe Brauer 2017-08-15 9:12 ` Neil Jerram 2017-08-16 12:28 ` Uwe Brauer 2017-08-16 17:25 ` Berry, Charles 2017-08-16 17:41 ` Eric S Fraga 2017-08-16 17:48 ` Berry, Charles 2017-08-16 18:19 ` Eric S Fraga 2017-08-16 18:29 ` Berry, Charles 2017-08-16 21:52 ` Uwe Brauer [not found] <35e27070f72a4368bdf61b972ddef4c6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> 2017-08-15 17:21 ` Eric S Fraga 2017-08-16 12:33 ` Uwe Brauer 2017-08-16 17:10 ` Eric S Fraga 2017-08-17 15:09 ` Uwe Brauer [not found] ` <53741190f80c4e229a9c7f55cf46f1e6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> 2017-08-16 13:07 ` Eric S Fraga 2017-08-16 14:23 ` Adonay Felipe Nogueira
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).