From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id IEWvLIKPpmTkBwAASxT56A (envelope-from ) for ; Thu, 06 Jul 2023 11:55:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QORpK4KPpmRmKQEAG6o9tA (envelope-from ) for ; Thu, 06 Jul 2023 11:55:14 +0200 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 3E7CF38CFB for ; Thu, 6 Jul 2023 11:55:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHLgu-0003ED-Dm; Thu, 06 Jul 2023 05:54:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHLgs-0003Dr-DO for emacs-orgmode@gnu.org; Thu, 06 Jul 2023 05:54:22 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHLgq-0003gU-7X for emacs-orgmode@gnu.org; Thu, 06 Jul 2023 05:54:21 -0400 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-39cc64e4a44so417006b6e.0 for ; Thu, 06 Jul 2023 02:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688637258; x=1691229258; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NU/RQhAOTXCAPnduyFHhycsemJ6dbGygV3lOzXGXejU=; b=KPgqj9tOa3nksqMaM8/KTSmiDFma+4Agua1tO6nSk7ZQ9jJS/ccKfGaHSFVSUwdViw w+1ANO6Gxzd7EFicDleZis3WDvLxsS28apdz3a8kg1cC1hnyhF2+f44bRAf3XdPegYaY zyxQr/1Fvg6vBuDXGqEF7AGkdlOczpipacCbkbhhCQbSCp4Q/VgYRg2PKVICAwNmx6/C ypmtsjrH36nz2G1QzajgC1PyOMjRgY85Bua7UbEFTXWV8T/3KGr8Ebxm5cw9J1/uQpIm /n5+X04dPTUkZOShGC9MlUKA/g9TUlZzex51VWf2J/LGckZI0yA5+VLmkDpn8BJe9gR1 8EyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688637258; x=1691229258; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NU/RQhAOTXCAPnduyFHhycsemJ6dbGygV3lOzXGXejU=; b=S1WIe5sKs5505EP1hTLfA7241p7PQgBrtM9MzrkdHtlafU0Kavl+2OEEbB8R2mukml aehG2hfc8gdhNsftrZCGV/PU7i/mblzik2wEAwQeSQi9LNi2nlr12bC7NZMvLmyViyKZ l5VG19FzATuLDoZcAAoS+yVN2uO9sxZ+ShcJal+/C+Xm+dZHNNLn1yPng2DTEMIKAney m/9rEi8idMCiV4A6jk/ko5dGO46Rqpb3o2iZSRf+aJH7YmVaWmDPTaYqpu3r7ko0bjln Ewo5fEq6CiEVyfK/+Nhi3kCqqkTy0iHU43d18etU5bnUKxl6ucNragv2n8D+MNcyrQwK l5ig== X-Gm-Message-State: ABy/qLadMsubZWEWnUHkz8Bc9gxDYmK4rP81wsAiW6Eq5KqFw6wpc77G esp917macpWjRzMVXycjxkXcgWfQvx/Ts6Z7C5w= X-Google-Smtp-Source: APBJJlHOvhOzePxgVtFQxN5ONfuNzLmG/85BBJNVv8VdD5g0nkx+VCsTMPUENqD7D0NDrC7kB7/s9JJijU8n4rfmNW0= X-Received: by 2002:a05:6808:cf:b0:3a3:6113:ce79 with SMTP id t15-20020a05680800cf00b003a36113ce79mr987075oic.40.1688637258258; Thu, 06 Jul 2023 02:54:18 -0700 (PDT) MIME-Version: 1.0 References: <87y1jv0wlx.fsf@gmail.com> <87pm551yyf.fsf@gmail.com> In-Reply-To: <87pm551yyf.fsf@gmail.com> From: Liu Hui Date: Thu, 6 Jul 2023 17:54:06 +0800 Message-ID: Subject: Re: [PATCH] ob-python: support header argument `:results file graphics' To: Jack Kamm Cc: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=liuhui1610@gmail.com; helo=mail-oi1-x234.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688637314; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=NU/RQhAOTXCAPnduyFHhycsemJ6dbGygV3lOzXGXejU=; b=QO4pDMPowbBuN31fSKiK7D0YHqtc9yFwCSRyhBxvBECwI2yWlfOtR3SFd1SAns+yVzDpHZ jEOUqJPMxKYD0gX5dwbA+YNgwo/X1qa/5wHDDq5CD1sG5MeT8PSEuQL/9pLWjT0nuf13pO JIF6+NEGlwf8cGCWMolVJIlClgfgQHzWmqMgV3rFql3UR3iP1ci+vVvY4LD9Bs249Ea3c5 a61ygc060UqKc4BGQqYtWcasM6LxuziWra/jMZ7mCi2gDvNlcZ9rtCAtlpEPkhzfEa5Jms M25P1rLfoSFXhEpAbASmqLF0Ob9V5+2znHfGBsJqPPshcqrEenoWSffw8PuskQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KPgqj9tO; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688637314; a=rsa-sha256; cv=none; b=acd6QV71jslOzbohbD7VYtNG+CD4ABsBvt3rBWw6wZav4/478UezB9AoA7WcnN+SNEpqNW zXHIoaW27K645Z5eeNfhn9E9i9x3jivcAUNAgA2xjcP1Tb4Qh6yLkN3eB/38yczrhNUF/e cTrJqBqg9imEvdI6QTkV/UsszuwSqwceDIsTP4jDDi7HfGmcZcnQERvHEJafoorAETcULU CrmX1FZBFt4slldoxhHm+X0ZI0vvvWhW8jLgEg0trQzMdPtjv5LDcPalUUEhBKD5zASdVO cn1oIclpnYL0nOLTgrFxl8O+dOUocH4si9wa092CEQBBw1xEh7lsELYgo22CHg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.94 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KPgqj9tO; 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: 3E7CF38CFB X-Spam-Score: -4.94 X-TUID: 5onNYN2vAeXD Jack Kamm =E4=BA=8E2023=E5=B9=B47=E6=9C=886=E6=97=A5= =E5=91=A8=E5=9B=9B 11:49=E5=86=99=E9=81=93=EF=BC=9A > I would propose the following instead: for ":results output graphics", > ob-python should plot the gcf, and clear it beforehand. But for > ":results value graphics", the ob-python block should return a > matplotlib Figure object to plot, which would allow keeping and > modifying a Figure between blocks. > > I actually proposed that behavior before in this patch: > > https://list.orgmode.org/87eenpfe77.fsf@gmail.com/ > > But never wound up applying it -- the patch was rather large, with a lot > of extra features, and I wasn't sure they were all worth the extra > complexity. Then life got in the way, and I never got around to > revisiting ob-python plotting, until now. I think your proposal about ":results graphics" is more flexible and complies the documentation. Since the patch has no real problem and the feature is useful indeed, I hope it can be merged instead of mine after the problem of documentation is resolved. As for other features in the patch, maybe it is better to convert dict/dataframe/array to table/list only when the result type is explicitly set to table or list?