From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4GrGB6Jv0WGRsQAAgWs5BA (envelope-from ) for ; Sun, 02 Jan 2022 10:25:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QOEVBaJv0WGB4AAA9RJhRA (envelope-from ) for ; Sun, 02 Jan 2022 10:25:54 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7D35FE219 for ; Sun, 2 Jan 2022 10:25:53 +0100 (CET) Received: from localhost ([::1]:56708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3x7g-0006YD-Kq for larch@yhetil.org; Sun, 02 Jan 2022 04:25:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3x6f-0006Y0-Hp for emacs-orgmode@gnu.org; Sun, 02 Jan 2022 04:24:49 -0500 Received: from [2607:f8b0:4864:20::b2c] (port=36354 helo=mail-yb1-xb2c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n3x6d-0002HF-JO for emacs-orgmode@gnu.org; Sun, 02 Jan 2022 04:24:49 -0500 Received: by mail-yb1-xb2c.google.com with SMTP id 139so59846834ybd.3 for ; Sun, 02 Jan 2022 01:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=koCRUKK9xrnrIAeVGcvepj0kXSPiVDJzzs5wzn3bwlU=; b=a88SW7kFLGnVP+H9g71w3tpU3I2LU6Aou8xTHy3iunSurmyihUcJ4unskzX0Ik8EUN 2w5450+fPzY2+B65YOR+HKMsDE3X/S9RD1RwA5MY0YJYxnHt1XzUwPsNGK0udCjLhD4+ O7aRjYIANk/f7Y3Dl12Cbx1JvtNiEXpWJ7UQzmihGxn1STRkZ476Wpd6Nu7/zCzTJex8 PEyjXDqHvj0bIuVFzzWdQAOp6zAIwAGNOPMr5mmSmZF0QetxwyUyXP9xHSpnB/Uma2+V VI2wddles/C3hBKunn6mU1J1HWFR2ElJYpq/i+W+1QSegdRKUGYAOEquqAsaapw5dPoB q+Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=koCRUKK9xrnrIAeVGcvepj0kXSPiVDJzzs5wzn3bwlU=; b=EXeJ5v6UTtd/FLaI7LJq/ndZkiPBTC7NY+G5V8dN3zeMWuuDyg7Q7E9h8UsR/MS8Mb sR2D8ZjZ8jHD44NXt8fzt62mP/2RA8YY4zwNc0RWhsyXkEgocWD+jbR4rtoboQ5SMKpU gmlJHcKttZWu22lFnyHoWvwPp99oJU5WRaqwcMaAWmCQZcNOAA8Rd8URMOxN726WCnDO fuuK8XMdU8fENzMavNV8V8b9j0OUruK8JliVMaAKiT+BIDKvIrp57hyJw+hRMXIViUVz +Ejw3/GF6mBPOTwveJ52QwDHi3AaQFzmcYqxonCVnr5QsoqFjapwzyUqgXgXUnxdCq+n JxDw== X-Gm-Message-State: AOAM530F+btp/hMrBR+0cpdN2jP2mJxxyC9Na88PbEP2Tk01u8rDeHr/ wGHr4oMl4NpAgV28FczRCxXVB/IFW1ABXeesz5MEoAwfKQEW X-Google-Smtp-Source: ABdhPJzuJaIkSBneJRIm5t5xRoM/jall4PeAx5zHYZIUr3BjrmSZ8KLDMKMgwu4Nw0yn4tyZ+rfulR0hY686vzgl2pc= X-Received: by 2002:a05:6902:1246:: with SMTP id t6mr21418711ybu.431.1641115485897; Sun, 02 Jan 2022 01:24:45 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: stardiviner Date: Sun, 2 Jan 2022 17:24:19 +0800 Message-ID: Subject: [SOLVED] Re: How to auto insert inline image link for org-plot/gnuplot result plot? To: Org-mode Content-Type: multipart/alternative; boundary="00000000000092899505d495f9bf" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::b2c (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::b2c; envelope-from=numbchild@gmail.com; helo=mail-yb1-xb2c.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641115553; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=koCRUKK9xrnrIAeVGcvepj0kXSPiVDJzzs5wzn3bwlU=; b=Vcx7NoeobfiQPoeY0wNXcaGw37H/LwA948DjSEnQjHx2E+qDBO5eVnTL0ZFNqyur1ISiko 9tOY0kFgqs8+pZp74QK866JOQ6QB2ObszIhDMCVVE+CQR5hoN9LGGO6TBlkY+PhKm72QlB JyBQ9SYyulhdh+aSUsz43KJolJUpfYqpsolNanKh89ApR40Y0FPMh2ZSm3xMSV/hRahhlF 4r31seYwEb70mG+I2R+LbgQxqDv12FzU8rXD+gwyCdIN8wwuWa77q+nLZwzdps49v9tWPo ZhqGdvVzEku4YJXToOi5tx9dRiFXTmXglGaTLBy5vxjF/ZCfnbYdH4Rzm1T4Wg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641115553; a=rsa-sha256; cv=none; b=uFCLmlwid/SWrwDgY2QVV/8KpzBa1Lqfza5vue7XAaIlBr9PdrS0Np/S0IoHFbof7hGWna 1SHBGguODmvr7+0xO2FTsdkcGhKfdrRwMw9h016DK8YPqusFsbRakh/rBju4u2rFnZIqTi I1FX9zGeLU98u+2mmcWymdq29Hpm9dcTH5oO59nnYkEHog58wLzwkLBtmrJUYKYIyIGvwM YwLmXVCs0JF6Hft1tg02FDmItyzY/LHU8p93D2ylu/l5ZIuoaMVjKCCi7/UDYMYPqeljZr zNTfNrxe1bH18m0mpLpF4rjcnsvLyghLs88JU+ft31Af5P+fKDvBVhGU1h4Pnw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a88SW7kF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.58 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a88SW7kF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7D35FE219 X-Spam-Score: -4.58 X-Migadu-Scanner: scn0.migadu.com X-TUID: QRl7SqoSlqf1 --00000000000092899505d495f9bf Content-Type: text/plain; charset="UTF-8" I write an advice for this. #+begin_src emacs-lisp ;; `org-plot/gnuplot' advice of auto insert org gnuplot result image file. (advice-add 'org-plot/gnuplot :around #'org-plot/gnuplot-insert-org-image-link) (defun org-plot/gnuplot-insert-org-image-link (origin-func &rest args) "Auto insert `org-plot/gnuplot' generated plot image file link." (save-excursion (org-plot/goto-nearest-table) ;; Set default options. (setf params nil) (dolist (pair org-plot/gnuplot-default-options) (unless (plist-member params (car pair)) (setf params (plist-put params (car pair) (cdr pair))))) ;; Collect options. (while (and (equal 0 (forward-line -1)) (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) (setf param-file (plist-get params :file)) (apply origin-func args) (goto-char (org-table-end)) (org-indent-line) (insert (format "\n")) (org-indent-line) (insert (format "[[%s][%s]]" (expand-file-name param-file) param-file)) (org-indent-line) (insert (format "\n")) (when org-startup-with-inline-images (org-redisplay-inline-images))) #+end_src I suggest `org-plot.el` library can support this feature. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sun, Jun 18, 2017 at 1:55 PM numbchild@gmail.com wrote: > I want to auto insert inline image for `org-plot/gnuplot` result plot > below the table. Like this: > > ```org > #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange > [0:]" > | Sede | Max cites | H-index | > |-----------+-----------+---------| > | Chile | 257.72 | 21.39 | > | Leeds | 165.77 | 19.68 | > | Sao Paolo | 71.00 | 11.50 | > | Stockholm | 134.19 | 14.33 | > | Morelia | 257.56 | 17.67 | > > Press =[C-c " g]= on upper table to generate gnuplot plot image (*NOTE*: > the > generated plot image is in currently working directory). > > #+ATTR_ORG: :width 250 > #+ATTR_LATEX: :width 2.5in > #+ATTR_HTML: :width 250px > [[file:org-plot.png]] > ``` > > I have an idea, add an advice on `org-plot/gnuplot` with a user helper > function to inser the inline image link. > This advice need to: > > - locate point below the table. > - get the `org-plot/gnuplot` result plot image link. > - insert inline image link. > > [stardiviner] GPG key ID: 47C32433 > IRC(freeenode): stardiviner Twitter: @numbchild > Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 > Blog: http://stardiviner.github.io/ > --00000000000092899505d495f9bf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I write an advice for this.

;; `org-plot/gnuplot' advice of auto inse= rt org gnuplot result image file.
=C2=A0 (advice-add 'org-plot/gnupl= ot :around #'org-plot/gnuplot-insert-org-image-link)

=C2=A0 (def= un org-plot/gnuplot-insert-org-image-link (origin-func &rest args)
= =C2=A0 =C2=A0 "Auto insert `org-plot/gnuplot' generated plot image= file link."
=C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0 =C2=A0 = (org-plot/goto-nearest-table)
=C2=A0 =C2=A0 =C2=A0 ;; Set default option= s.
=C2=A0 =C2=A0 =C2=A0 (setf params nil)
=C2=A0 =C2=A0 =C2=A0 (dolis= t (pair org-plot/gnuplot-default-options)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (u= nless (plist-member params (car pair))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (setf params (plist-put params (car pair) (cdr pair)))))
=C2=A0 =C2= =A0 =C2=A0 ;; Collect options.
=C2=A0 =C2=A0 =C2=A0 (while (and (equal 0= (forward-line -1))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (looking-at "[[:space:]]*#\\+"))
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (setf params (org-plot/collect-options params))))
=C2=A0 =C2= =A0 (setf param-file (plist-get params :file))
=C2=A0 =C2=A0 (apply orig= in-func args)
=C2=A0 =C2=A0 (goto-char (org-table-end))
=C2=A0 =C2=A0= (org-indent-line) (insert (format "\n"))
=C2=A0 =C2=A0 (org-i= ndent-line) (insert (format "[[%s][%s]]" (expand-file-name param-= file) param-file))
=C2=A0 =C2=A0 (org-indent-line) (insert (format "= ;\n"))
=C2=A0 =C2=A0 (when org-startup-with-inline-images (org-redi= splay-inline-images)))
#+end_src

I suggest `org-plo= t.el` library can support this feature.

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint = =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.gi= thub.io/


On Sun, Jun 18, 2017 at 1= :55 PM numbchild@gmail.com <<= a href=3D"mailto:numbchild@gmail.com">numbchild@gmail.com> wrote:
<= div style=3D"font-family:"trebuchet ms",sans-serif">I want to aut= o insert inline image for `org-plot/gnuplot` result plot below the table. L= ike this:

```org
#+PLOT: titl= e:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange= [0:]"
| Sede= =C2=A0 =C2=A0 =C2=A0| Max cites | H-index |
|-----------+-----------+---------|
=
| Chile =C2=A0 =C2=A0 | =C2=A0= =C2=A0257.72 | =C2=A0 21.39 |
| Leeds =C2=A0 =C2=A0 | =C2=A0 =C2=A0165.77 | =C2=A0 19.68 |
| Sao Paolo | =C2= =A0 =C2=A0 71.00 | =C2=A0 11.50 |
| Stockholm | =C2=A0 =C2=A0134.19 | =C2=A0 14.33 |
| Morelia =C2=A0 | =C2=A0 = =C2=A0257.56 | =C2=A0 17.67 |

P= ress =3D[C-c " g]=3D on upper table to generate gnuplot plot image (*N= OTE*: the
generate= d plot image is in currently working directory).

#+ATTR_ORG: :width 250
#+ATTR_LATEX: :width 2.5in
#+ATTR_HTML: :width 250px
= [[file:org-plot.png]]
<= div style=3D"font-family:"trebuchet ms",sans-serif">```

I have an idea, ad= d an advice on `org-plot/gnuplot` with a user helper function to inser the = inline image link.
This advice need to:

- locate point below the table.
- get the `org-plot/gnuplo= t` result plot image link.
- insert inline image link.

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): stardiviner =C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint= =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.g= ithub.io/
--00000000000092899505d495f9bf--