[PATCH] fix showing of units in "draw"

8 views
Skip to first unread message

Qian Yun

unread,
May 2, 2024, 6:15:00 AM5/2/24
to fricas-devel
Currently, draw(x,x=0..10,unit==[1.0,2.0])
does not show units by default, you have to click the control
panel button or use 'units(%,1,"on")'.

I think that by specifying "unit" options in "draw", the intention
is to show units.

This is also the case in some of the graphs in reference book,
for example in section 7.1.4 (page 234-236), where several graphs
should show units, but they didn't.

Following patch fixes this.

- Qian

diff --git a/src/algebra/view2D.spad b/src/algebra/view2D.spad
index bda55299..4799f336 100644
--- a/src/algebra/view2D.spad
+++ b/src/algebra/view2D.spad
@@ -808,6 +808,8 @@ TwoDimensionalViewport () : Exports ==
Implementation where
viewport := viewport2D()
viewport.graphsField.1 := g
viewport.optionsField := opts
+ if not empty? units(opts, []) then
+ viewport.graphStatesField.1.units := yes
makeViewport2D0 viewport

makeViewport2D viewport == makeViewport2D0 copy(viewport::Rep)

Waldek Hebisch

unread,
May 2, 2024, 10:23:34 AM5/2/24
to fricas...@googlegroups.com
On Thu, May 02, 2024 at 06:14:54PM +0800, Qian Yun wrote:
> Currently, draw(x,x=0..10,unit==[1.0,2.0])
> does not show units by default, you have to click the control
> panel button or use 'units(%,1,"on")'.
>
> I think that by specifying "unit" options in "draw", the intention
> is to show units.
>
> This is also the case in some of the graphs in reference book,
> for example in section 7.1.4 (page 234-236), where several graphs
> should show units, but they didn't.
>
> Following patch fixes this.

OK.


> - Qian
>
> diff --git a/src/algebra/view2D.spad b/src/algebra/view2D.spad
> index bda55299..4799f336 100644
> --- a/src/algebra/view2D.spad
> +++ b/src/algebra/view2D.spad
> @@ -808,6 +808,8 @@ TwoDimensionalViewport () : Exports == Implementation
> where
> viewport := viewport2D()
> viewport.graphsField.1 := g
> viewport.optionsField := opts
> + if not empty? units(opts, []) then
> + viewport.graphStatesField.1.units := yes
> makeViewport2D0 viewport
>
> makeViewport2D viewport == makeViewport2D0 copy(viewport::Rep)
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/bb88c685-409a-42f8-8567-89c1a3781304%40gmail.com.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages