Draw math functions with EyeSee

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Draw math functions with EyeSee

SergeStinckwich
Hi all,

i try to use EyeSee to plot mathematical functions with ESLineDiagram.
They is not easy as i might expect at the beginning :-)
The problem is EyeSee is using collections as models. I try to
transform the function as a collection like above but maybe there is a
better way to do that.

|diag f functionAsModel|
f := [:x | x*x].
functionAsModel := (0 to:10 by:0.1) collect:[:each | f value:each].
diag := ESDiagramRenderer new.
(diag lineDiagram)
        y: #yourself;
        yAxisLabel: 'X^2';
        rotatedLabels: true;
        regularAxis;
        defaultColor: Color green;
        models: functionAsModel.
diag open

Regards,
--
Serge Stinckwich
UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
Every DSL ends up being Smalltalk
http://doesnotunderstand.org/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Draw math functions with EyeSee

abergel
I would love to have a Pharo-based solution for doing numerical analysis. This implies having a .pdf (or .ps, if simpler) exporter of the graph.

Alexandre


On 22 Mar 2012, at 07:06, Serge Stinckwich wrote:

> Hi all,
>
> i try to use EyeSee to plot mathematical functions with ESLineDiagram.
> They is not easy as i might expect at the beginning :-)
> The problem is EyeSee is using collections as models. I try to
> transform the function as a collection like above but maybe there is a
> better way to do that.
>
> |diag f functionAsModel|
> f := [:x | x*x].
> functionAsModel := (0 to:10 by:0.1) collect:[:each | f value:each].
> diag := ESDiagramRenderer new.
> (diag lineDiagram)
> y: #yourself;
> yAxisLabel: 'X^2';
> rotatedLabels: true;
> regularAxis;
> defaultColor: Color green;
> models: functionAsModel.
> diag open
>
> Regards,
> --
> Serge Stinckwich
> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
> Every DSL ends up being Smalltalk
> http://doesnotunderstand.org/
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Draw math functions with EyeSee

Andre Hora
You can set the function as #y axis and then you don't need to create a "functionAsModel":

| diag f |

diag := ESDiagramRenderer new.
(diag lineDiagram)
       y: [:x | x*x];
       yAxisLabel: 'X^2';
       rotatedLabels: true;
       regularAxis;
       defaultColor: Color green;
       models: (0 to: 10 by: 0.1).
diag open

On Thu, Mar 22, 2012 at 2:31 PM, Alexandre Bergel <[hidden email]> wrote:
I would love to have a Pharo-based solution for doing numerical analysis. This implies having a .pdf (or .ps, if simpler) exporter of the graph.

Alexandre


On 22 Mar 2012, at 07:06, Serge Stinckwich wrote:

> Hi all,
>
> i try to use EyeSee to plot mathematical functions with ESLineDiagram.
> They is not easy as i might expect at the beginning :-)
> The problem is EyeSee is using collections as models. I try to
> transform the function as a collection like above but maybe there is a
> better way to do that.
>
> |diag f functionAsModel|
> f := [:x | x*x].
> functionAsModel := (0 to:10 by:0.1) collect:[:each | f value:each].
> diag := ESDiagramRenderer new.
> (diag lineDiagram)
>       y: #yourself;
>       yAxisLabel: 'X^2';
>       rotatedLabels: true;
>       regularAxis;
>       defaultColor: Color green;
>       models: functionAsModel.
> diag open
>
> Regards,
> --
> Serge Stinckwich
> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
> Every DSL ends up being Smalltalk
> http://doesnotunderstand.org/
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
Andre Hora


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Draw math functions with EyeSee

SergeStinckwich
Hum, much better !
Thank you.

On Thu, Mar 22, 2012 at 9:20 PM, Andre Hora <[hidden email]> wrote:

> You can set the function as #y axis and then you don't need to create a
> "functionAsModel":
>
> | diag f |
>
>
> diag := ESDiagramRenderer new.
> (diag lineDiagram)
>        y: [:x | x*x];
>
>        yAxisLabel: 'X^2';
>        rotatedLabels: true;
>        regularAxis;
>        defaultColor: Color green;
>        models: (0 to: 10 by: 0.1).
> diag open
>
>
> On Thu, Mar 22, 2012 at 2:31 PM, Alexandre Bergel <[hidden email]>
> wrote:
>>
>> I would love to have a Pharo-based solution for doing numerical analysis.
>> This implies having a .pdf (or .ps, if simpler) exporter of the graph.
>>
>> Alexandre
>>
>>
>> On 22 Mar 2012, at 07:06, Serge Stinckwich wrote:
>>
>> > Hi all,
>> >
>> > i try to use EyeSee to plot mathematical functions with ESLineDiagram.
>> > They is not easy as i might expect at the beginning :-)
>> > The problem is EyeSee is using collections as models. I try to
>> > transform the function as a collection like above but maybe there is a
>> > better way to do that.
>> >
>> > |diag f functionAsModel|
>> > f := [:x | x*x].
>> > functionAsModel := (0 to:10 by:0.1) collect:[:each | f value:each].
>> > diag := ESDiagramRenderer new.
>> > (diag lineDiagram)
>> >       y: #yourself;
>> >       yAxisLabel: 'X^2';
>> >       rotatedLabels: true;
>> >       regularAxis;
>> >       defaultColor: Color green;
>> >       models: functionAsModel.
>> > diag open
>> >
>> > Regards,
>> > --
>> > Serge Stinckwich
>> > UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
>> > Every DSL ends up being Smalltalk
>> > http://doesnotunderstand.org/
>> > _______________________________________________
>> > Moose-dev mailing list
>> > [hidden email]
>> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
>
>
> --
> Andre Hora
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>



--
Serge Stinckwich
UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
Every DSL ends up being Smalltalk
http://doesnotunderstand.org/

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Draw math functions with EyeSee

Stéphane Ducasse
In reply to this post by abergel
There is pdf framework under development (I saw some nice demos it will be open-source) so this means that we could have EyeSee to output pdf.
I really think that pushing EyeSee to provide model that after can be drawn in different format is the way to go else we will bind the model
to the layout/output.

Stef


> I would love to have a Pharo-based solution for doing numerical analysis. This implies having a .pdf (or .ps, if simpler) exporter of the graph.
>
> Alexandre
>
>
> On 22 Mar 2012, at 07:06, Serge Stinckwich wrote:
>
>> Hi all,
>>
>> i try to use EyeSee to plot mathematical functions with ESLineDiagram.
>> They is not easy as i might expect at the beginning :-)
>> The problem is EyeSee is using collections as models. I try to
>> transform the function as a collection like above but maybe there is a
>> better way to do that.
>>
>> |diag f functionAsModel|
>> f := [:x | x*x].
>> functionAsModel := (0 to:10 by:0.1) collect:[:each | f value:each].
>> diag := ESDiagramRenderer new.
>> (diag lineDiagram)
>> y: #yourself;
>> yAxisLabel: 'X^2';
>> rotatedLabels: true;
>> regularAxis;
>> defaultColor: Color green;
>> models: functionAsModel.
>> diag open
>>
>> Regards,
>> --
>> Serge Stinckwich
>> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
>> Every DSL ends up being Smalltalk
>> http://doesnotunderstand.org/
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev