3D sageplot static PNG quality (missing labels, etc.) — known workaround?

29 views
Skip to first unread message

Juan Carlos Bustamante

unread,
Sep 5, 2026, 1:48:18 PM (6 days ago) Sep 5
to PreTeXt support
Hi all,

I'm using <sageplot variant="3d"> for a 3D plot. The interactive HTML/three.js output looks great — text labels (text3d) included. But the static PNG used for the PDF/LaTeX version is noticeably worse overall, not just missing the text labels: the same Graphics3d object renders in a visibly lower-quality way for print than what I can get elsewhere.

A correctly-labeled, good-looking static image of the same plot is trivial to get outside this pipeline: e.g. a screenshot of the same Graphics3d object shown in a Jupyter notebook, where everything renders fine. So the "author supplies a static substitute" workflow is exactly the right one here — <sageplot> just has no attribute or child to receive it. (<interactive> already has this, via @preview or a <static> child — it's really just <sageplot> that's missing the equivalent.)

Is this a known limitation, and is there a workaround to get a good static image for print while keeping the interactive version for HTML? Or is something like @preview/<static> planned for <sageplot> too?

Thanks!

JC

Rob Beezer

unread,
Sep 5, 2026, 6:20:56 PM (5 days ago) Sep 5
to pretext...@googlegroups.com
Dear JC,

Our 3D plots from Sage have never been very good, and likely the code has not
been touched in years. So maybe we need to use better Sage code. Encouraging
authors to do extra work (manual screenshots) and override our automatic
production does not sound like the first solution to try.

Can we do something better (different Sage code) to get a better PNG (or other
format) image? Have you experimented within Sage itself?

I guess at worst, we might do the screenshots ourselves (i.e. automatically with
our existing tools)?

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-support/
> ef4649e2-39ac-4d63-bae9-e0329f1d9187n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/ef4649e2-39ac-4d63-bae9-
> e0329f1d9187n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Juan Carlos Bustamante

unread,
Sep 6, 2026, 11:07:23 AM (5 days ago) Sep 6
to pretext...@googlegroups.com
Dear Bob,

Yes, the problem comes from the fact that sage uses tachyon to save the 3d figures (I think). In any case, when i do my figure in a jupyter notebook and use Fig.save(...) I get the poor image pretext uses to build the pdf. Since the figures obtained as a preview for  an "interactive" pointing to the sage one cell-server are quite good, I would say that this is the right mechanism. So is this a feature request? In the meanwhile, is there a workaround?

JC 

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAxRC5PdHRjODk.1788646853%40pnsh.

Mitch Keller

unread,
Sep 8, 2026, 4:06:15 PM (3 days ago) Sep 8
to pretext...@googlegroups.com
Hi JC,

You can use an interactive with @platform=“sage” containing a slate with @surface=“sage”. That will get you the automated screenshots. For example, Figure 11.8.9 in ACM is generated by xi:include of this file in this source file

I didn’t actually know that one could use a sageplot with code for a 3D image inside it, so this is how we’ve done all of ours.

Mitch

Juan Carlos Bustamante

unread,
Sep 8, 2026, 9:09:41 PM (2 days ago) Sep 8
to pretext...@googlegroups.com

HI Mitch,

Yes, I know I can do that. As I point ou, the figures obtained this way are fine, but in the .pdf version one gets those QR codes, this is why I prefer to avoir interactives. Is there a way to avoir the QR code? They are too big, I simply do not want them on the .pdf version of what I am writing.

Perhaps I am wrong, but I tend to think that relying on my local SAGE is kind of better. Any advice on this?


JC

Mitch Keller

unread,
Sep 9, 2026, 10:14:26 AM (2 days ago) Sep 9
to pretext...@googlegroups.com
Hi JC,

For ACM, we use a mixture of just 3D plots and more elaborate Sage interacts, so standardizing has been mostly good for us. However, we do run into situations where the Javascript in the page of the book tends to be overloaded, so investigating if using sageplot for 3D may be something we look into. (There was also a day where the SageCellServer was down, which crippled our text.)

Disabling the QR codes could certainly be a feature request with possibly some design discussion around it. (For example, I imagine some texts will have sufficient margin space for the QR code to go into the margin, while others will have a page size that doesn’t leave much room for being in the margin. Some publishers may envision meaningful use of the PDF version in an electronic form, so the current triple of links might be useful for them. Other publishers want HTML to be the version used by readers on devices with PDF only for print, so just having the QR code will suffice. An option to configure the sidebyside that is produced for the static image and the QR code would be good as well.)

We are going to be shifting pretty seriously into thinking about the print version of ACM in the very near future, and getting good static versions (with minimal manual screenshotting) as well as a nice way for readers to access the interactive version will be a priority for us. 

Mitch

Juan Carlos Bustamante

unread,
Sep 10, 2026, 2:52:12 PM (14 hours ago) Sep 10
to pretext...@googlegroups.com

Thanks Mitch, for your insight. 

So, at the end of the day, at this point, there is no way to obtain the nice figure one gets from sage one-cell server through an <interactive>, but directly from a <sageplot variant = "3d">. Am I right?

Does it make sense to ask for an improvement on the generation of <sageplot variant = "3d"> either by parsing the sage code to a one-cell server and then doing the screen shot in the usual way, do all this locally, from sage, but avoiding sage itself to save the figure? 

In any case, at this point I am quite stuck with this. Any suggestion?


JC

Rob Beezer

unread,
Sep 10, 2026, 2:56:40 PM (14 hours ago) Sep 10
to pretext...@googlegroups.com
On 9/10/26 11:52, Juan Carlos Bustamante wrote:
> Any suggestion?

Copied from below, a suggestion which I do not think has been pursued at all.

>>>>> Our 3D plots from Sage have never been very good, and likely the code
>>>>> has not
>>>>> been touched in years. So maybe we need to use better Sage code.
>>>>> Encouraging
>>>>> authors to do extra work (manual screenshots) and override our automatic
>>>>> production does not sound like the first solution to try.
>>>>>
>>>>> Can we do something better (different Sage code) to get a better PNG
>>>>> (or other
>>>>> format) image? Have you experimented within Sage itself?

Rob
>>>> Figure 11.8.9 <https://activecalculus.org/multi/S-mv_deriv-
>>>> directional.html#DDexample2> in ACM is generated by xi:include of this file
>>>> <https://github.com/active-calculus/active-calculus-vector/blob/main/source/
>>>> interacts/DDExample2.txt> in this source file <https://github.com/active-
>>>> calculus/active-calculus-vector/
>>>> blob/692c03c893ec7fd28e23116fb65764197c6a4029/source/
>>>> S_mv_deriv_directional_deriv.ptx#L345>
>>>>
>>>> I didn’t actually know that one could use a sageplot with code for a 3D
>>>> image inside it, so this is how we’ve done all of ours.
>>>>
>>>> Mitch
>>>>
>>>>> On Sep 6, 2026, at 10:07 AM, Juan Carlos Bustamante <jotac...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Dear Bob,
>>>>>
>>>>> Yes, the problem comes from the fact that sage uses tachyon to save the 3d
>>>>> figures (I think). In any case, when i do my figure in a jupyter notebook
>>>>> and use Fig.save(...) I get the poor image pretext uses to build the pdf.
>>>>> Since the figures obtained as a preview for  an "interactive" pointing to
>>>>> the sage one cell-server are quite good, I would say that this is the right
>>>>> mechanism. So is this a feature request? In the meanwhile, is there a
>>>>> workaround?
>>>>>
>>>>> JC
>>>>>
>>>>> Le sam. 5 sept. 2026, à 18 h 20, 'Rob Beezer' via PreTeXt support <pretext-
>>>>> sup...@googlegroups.com> a écrit :
>>>>> support%2Bunsu...@googlegroups.com> <mailto:pretext-
>>>>> > support+u...@googlegroups.com
>>>>> <mailto:support%2Bunsu...@googlegroups.com>>.
>>>>> > To view this discussion visit https://groups.google.com/d/msgid/
>>>>> pretext-support/
>>>>> > ef4649e2-39ac-4d63-bae9-e0329f1d9187n%40googlegroups.com
>>>>> <http://40googlegroups.com/> <https://
>>>>> > groups.google.com/d/msgid/pretext-support/ef4649e2-39ac-4d63-bae9-
>>>>> <http://groups.google.com/d/msgid/pretext-support/ef4649e2-39ac-4d63-
>>>>> bae9->
>>>>> > e0329f1d9187n%40googlegroups.com?utm_medium=email&utm_source=footer
>>>>> <http://40googlegroups.com/?utm_medium=email&utm_source=footer>>.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "PreTeXt support" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to pretext-suppo...@googlegroups.com
>>>>> <mailto:pretext-support%2Bunsu...@googlegroups.com>.
>>>>> To view this discussion visit https://groups.google.com/d/msgid/
>>>>> pretext-support/MTAwMDAxRC5PdHRjODk.1788646853%40pnsh.
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups
>>>>> "PreTeXt support" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>>> email to pretext-suppo...@googlegroups.com.
>>>>> To view this discussion visit https://groups.google.com/d/msgid/pretext-
>>>>> support/
>>>>> CAHyrz10aFCJemJ7KgOXX2BTJ3%3Dq7n4ric%2B8yjMSzveiHLEQ3hQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/pretext-support/
>>>>> CAHyrz10aFCJemJ7KgOXX2BTJ3%3Dq7n4ric%2B8yjMSzveiHLEQ3hQ%40mail.gmail.com?
>>>>> utm_medium=email&utm_source=footer>.
>>>>
>>>> --
>>>> Mitch Keller
>>>> mi...@rellek.net
>>>>
>>>> http://www.rellek.net/
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "PreTeXt support" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> email to pretext-suppo...@googlegroups.com.
>>>> To view this discussion visit https://groups.google.com/d/msgid/pretext-
>>>> support/02B3229F-83C0-4AB1-9CFF-28EC5B139E76%40rellek.net <https://
>>>> groups.google.com/d/msgid/pretext-
>>>> support/02B3229F-83C0-4AB1-9CFF-28EC5B139E76%40rellek.net?
>>>> utm_medium=email&utm_source=footer>.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "PreTeXt support" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to pretext-suppo...@googlegroups.com.
>>> To view this discussion visit https://groups.google.com/d/msgid/pretext-
>>> support/aad2292b-2713-4584-8bcf-c59053cb6202%40gmail.com <https://
>>> groups.google.com/d/msgid/pretext-support/aad2292b-2713-4584-8bcf-
>>> c59053cb6202%40gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> Mitch Keller
>> mi...@rellek.net
>>
>> http://www.rellek.net/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pretext-suppo...@googlegroups.com.
>> To view this discussion visit https://groups.google.com/d/msgid/pretext-
>> support/F0250176-6A5B-467F-A89C-B9C3CBACC52C%40rellek.net <https://
>> groups.google.com/d/msgid/pretext-support/F0250176-6A5B-467F-A89C-
>> B9C3CBACC52C%40rellek.net?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> support/70eceae9-6086-47ef-9cd0-8a955ec4b8d1%40gmail.com <https://
> groups.google.com/d/msgid/pretext-
> support/70eceae9-6086-47ef-9cd0-8a955ec4b8d1%40gmail.com?
> utm_medium=email&utm_source=footer>.

Juan Carlos Bustamante

unread,
Sep 10, 2026, 3:01:32 PM (14 hours ago) Sep 10
to pretext...@googlegroups.com
Hello Bob,

Sage, called by pretext exports that poor .png figure. I did not modify
my sage code significantly, since the figure looks god in the applet, in
a jupyter notebook, in the one-cell server. What should I try if I try
to modify the sage code?

On the other hand, I had no answer about the two possibilities I mention.


Thanks,


JC
Reply all
Reply to author
Forward
0 new messages