Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Redesign plotting API #558

Open
WhiteBlackGoose opened this issue Jan 10, 2022 · 0 comments
Open

[WIP] Redesign plotting API #558

WhiteBlackGoose opened this issue Jan 10, 2022 · 0 comments
Labels
Area: Interactive The issue is related to the AngouriMath.Interactive package Design document For issues representing detailed design of new API or feature Opinions wanted We are interested in your opinion about the topic Proposal Contribute to the project by proposing some improvements

Comments

@WhiteBlackGoose
Copy link
Member

WhiteBlackGoose commented Jan 10, 2022

Plotting API

Since 1.4 preview 1 one now can plot functions in "experimental"/preview mode. Time to make it prettier!

Root types

Will be in class Plot:

module AngouriMath.Interactive
...
type AnyFunc = obj
type AnyVar = obj
...
type Plot =
    ... // here the static members come

2D

Signature

static member plottingFunction(func : AnyFunc, 
    [<Optional;DefaultParameterValue(null)>] ?var : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?range : double seq
) : GenericChart

Functions

Function Default range
cartesianLine [-1.0..0.01..1.0]
cartesianScatter2D [-1.0..0.01..1.0]
polarLine [0.0..0.01..3.1415]
polarScatter [0.0..0.01..3.1415]

3D

Signature

static member plottingFunction(func : AnyFunc, 
    [<Optional;DefaultParameterValue(null)>] ?var1 : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?var2 : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?range1 : double seq,
    [<Optional;DefaultParameterValue(null)>] ?range2 : double seq
) : GenericChart

If no var was specified, they're taken from the expression in the alphabet order, e. g. for y + x the variables will be x and y.

Functions

Function Default range 1 Default range 2
cartesianSurface [-1.0..0.05..1.0] [-1.0..0.05..1.0]
cartesianScatter3D [-1.0..0.05..1.0] [-1.0..0.05..1.0]
sphericalSurface [0.0..0.05..3.1415] [0.0..0.05..3.1415]
sphericalScatter [0.0..0.05..3.1415] [0.0..0.05..3.1415]
cylindricalSurface [0.0..0.05..3.1415] [0.0..0.05..1.0]
cylindricalScatter [0.0..0.05..3.1415] [0.0..0.05..1.0]

Sliders

For 2D

static member withSlider2D(func : AnyFunc, 
    plottingFunc : (AnyFunc * AnyVar Option * double seq option) -> GenericChart,
    [<Optional;DefaultParameterValue(null)>] ?var : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?range : double seq,
    [<Optional;DefaultParameterValue(null)>] ?param : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?paramRange : double seq,
) : GenericChart

If no parameter and argument is specified, the variables taken from the expression are ordered in alphabet order, and the parameter is the first of them. For example, in x + a the paramater is a and the variable is x.

The default value for range now is [1.0..0.1..2.0], but no default value for range (it will be passed as-is).

For 3D

static member withSlider3D(func : AnyFunc, 
    plottingFunc : (AnyFunc * AnyVar Option * AnyVar Option * double seq Option * double seq Option) -> GenericChart,
    [<Optional;DefaultParameterValue(null)>] ?var1 : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?var2 : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?range1 : double seq,
    [<Optional;DefaultParameterValue(null)>] ?range2 : double seq,
    [<Optional;DefaultParameterValue(null)>] ?param : AnyVar,
    [<Optional;DefaultParameterValue(null)>] ?paramRange : double seq,
) : GenericChart

Likewise, the param variable is defined as the first one by alphabet by default.

Unresolved questions

Can we let input expressions? e. g. range = [ 0.0..0.1.. (2 * pi) ]

@WhiteBlackGoose WhiteBlackGoose added Proposal Contribute to the project by proposing some improvements Opinions wanted We are interested in your opinion about the topic Design document For issues representing detailed design of new API or feature labels Jan 10, 2022
@WhiteBlackGoose WhiteBlackGoose changed the title Redesign plotting API [WIP] Redesign plotting API Jan 10, 2022
@WhiteBlackGoose WhiteBlackGoose added the Area: Interactive The issue is related to the AngouriMath.Interactive package label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Interactive The issue is related to the AngouriMath.Interactive package Design document For issues representing detailed design of new API or feature Opinions wanted We are interested in your opinion about the topic Proposal Contribute to the project by proposing some improvements
Projects
None yet
Development

No branches or pull requests

1 participant