PreFigure Polar Coordinates

34 views
Skip to first unread message

Anansa Green

unread,
Jun 5, 2025, 2:13:19 PMJun 5
to PreTeXt support
Is there a way to set the coordinate system to polar in PreFigure? I can code concentric circles for the "grid" and parameterize all the things I want graphed, if necessary, but I wanted to see if there's a more elegant solution first. I couldn't find anything in the documentation or examples with polar coordinates.

Rob Beezer

unread,
Jun 5, 2025, 9:26:21 PMJun 5
to pretext...@googlegroups.com
Dear Anansa,

Unless somebody else knows, I'm sure David Austin will have an answer for you
soon, once he's back online.

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/
> dd5cb77c-cadb-4913-bd67-ce2549647e0fn%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/dd5cb77c-cadb-4913-bd67-
> ce2549647e0fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

David Austin

unread,
Jun 6, 2025, 3:25:14 AMJun 6
to pretext...@googlegroups.com
Hi Anansa,

Those features don't yet exist, but what you're asking certainly seems reasonable.  Can you send a list of things that you'd like to see?  I've thought of log-log plots, but this could be similar and good to think about at the same time.

Thanks, 
David 


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/MTAwMDAyOS5iZWV6ZXI.1749173177%40pnsh.

Anansa Green

unread,
Jun 9, 2025, 4:06:43 PMJun 9
to PreTeXt support
Hi David,

I have a working grid image so far (attached). I'm working on a pre-calculus text and was thinking of creating something similar to these two figures from the OpenStax text: Figure 8.4.20 and Figure 8.4.21.

Thanks,
Anansa

polar-r5.svg

David Austin

unread,
Jun 9, 2025, 5:46:45 PMJun 9
to pretext...@googlegroups.com
That helps a lot so thanks for sending those.  I think we're on the same page.  I can also imagine that you or someone else would want to fill the area of a polar curve.  I'll put something together soon and let you know.

Thanks again,
David

David Austin

unread,
Jun 11, 2025, 11:17:47 AMJun 11
to pretext...@googlegroups.com
Hi Anansa,

I've added some features for graphing in polar coordinates, which are described here:  Subsection 3.7.6: Polar coordinates.  I'm not sure what environment you're working in, but you will probably need to update your prefig installation (the PreFigure playground is always up to date though).  In a codespace or local installation, you can say "pip install --upgrade prefig" in a terminal to get version 0.3.1 of prefig.

Please let me know how this works for you.  I'm happy to make changes or additions if something can be improved.

Thanks,
David

On Mon, Jun 9, 2025 at 4:06 PM Anansa Green <anansa...@gmail.com> wrote:

Anansa Green

unread,
Aug 13, 2025, 11:39:00 AMAug 13
to PreTeXt support
I'm back! I thought I sent a very effusive thank-you message back in June, but apparently it was all in my head. It's been working beautifully, apart from one issue:

When plotting individual points with the <point> element and attribute @coordinates="polar" it seems the point is still plotting with rectangular coordinates.  Here's a copy/paste of my code and attached svg from the PreFigure Playground for reference:
<diagram dimensions="(600,600)" margins="0">
  <definition>r=2</definition>
  <definition>t=pi</definition>
  <coordinates bbox="(-5,-5,5,5)">

    <grid
      coordinates="polar"
      spacings="((0,.5,7),(0,pi/12,2*pi))"
      stroke="lightgray"
    />
    <grid
      coordinates="polar"
      spacings="((0,1,7),(0,pi/6,2*pi))"
      stroke="gray"
    />
    <axes
      hticks="(-5,1,5)"
      vticks="(-5,1,5)"
      hlabels="(-5,1,5)"
      vlabels="(-5,1,5)"
      clear-background="yes"          
    />
    <point
      coordinates="polar"
      p="(r,t)"
      clear-background="yes">
       <m>A</m>
      </point>
  </coordinates>
</diagram>
figure.svg

David Austin

unread,
Aug 13, 2025, 2:29:20 PMAug 13
to pretext...@googlegroups.com
Hi Anansa,

That doesn't work because I didn't think to do it!  Thanks for making this suggestion, which is now implemented and in the latest release.  I used your code in the Playground to make the image below (I included the attribute @offset="(0,2)" on the #point to move the label off the axis).  If you're working in a codespace or locally, you can update with "pip install prefig --upgrade".  I will update the documentation in 3.7.7 later today.

Just let me know if there's anything else that would be helpful.

Thanks again,
David

image.png


Reply all
Reply to author
Forward
0 new messages