Roassal Axes

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

Roassal Axes

Evan Donahue
Does anyone know how to change the min/max of the axes? I'm trying to figure out how to make x and y not start at 0.

data := #(1000 1001 1002).
b := RTGrapher new.
ds := RTData new.
ds points: data.
ds x: [ :c | c ].
ds y: [ :c | c ].
b add: ds.
b minX: 999.
b maxX: 1003.
b minY: 999.
b maxY: 1003.
b.

^ this does not do what I was expecting. If the data is all clustered together but far from zero, I'd like to adjust the axes so I can see the actual variation in the data, and not just a single point where everything is clustered. What is the right way to do this?

Thanks,
Evan
Reply | Threaded
Open this post in threaded view
|

Re: Roassal Axes

abergel
Hi Evan,

Roassal assumes to have 0 @ 0. However, you do a manual translation that works very well. Check this:

data := #(1000 1001 1002). 
b := RTGrapher new. 
ds := RTData new. 
ds points: data. 
ds x: [ :c | c - 1000]. 
ds y: [ :c | c - 1000 ].
b add: ds. 
b axisX labelConversion: [ :v | (v + 1000) asFloat ].
b axisY labelConversion: [ :v | (v + 1000) asFloat ].
b.
-=-=-=-=-=-=-=-=-=-=-=-=

The idea is to subtract a value using #x: and #y:, and then add it in #labelConversion:

Let us know how it goes

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



On Dec 19, 2017, at 12:44 PM, Evan Donahue <[hidden email]> wrote:

Does anyone know how to change the min/max of the axes? I'm trying to figure out how to make x and y not start at 0.

data := #(1000 1001 1002).
b := RTGrapher new.
ds := RTData new.
ds points: data.
ds x: [ :c | c ].
ds y: [ :c | c ].
b add: ds.
b minX: 999.
b maxX: 1003.
b minY: 999.
b maxY: 1003.
b.

^ this does not do what I was expecting. If the data is all clustered together but far from zero, I'd like to adjust the axes so I can see the actual variation in the data, and not just a single point where everything is clustered. What is the right way to do this?

Thanks,
Evan

Reply | Threaded
Open this post in threaded view
|

Re: Roassal Axes

abergel
Another example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"This example shows how to control the center of the graph.
Roassal assumes to have 0 @ 0, however you can subtract a value using #x: and #y:, and then add it in #labelConversion: to move the center of the graph"
graphCenter := 5 @ 10.
data := (-3.1415 to: 3.1415 by: 0.1) collect: [ :x |  x @ (x sin * 3 + 10) ]. 
b := RTGrapher new. 
ds := RTData new.
ds noDot; connectColor: Roassal2.Color blue. 
ds points: data. 
ds x: [ :p | p x - graphCenter x ]. 
ds y: [ :p | p y - graphCenter y ].
b add: ds. 
b axisX labelConversion: [ :v | (v + graphCenter x) asFloat ].
b axisY labelConversion: [ :v | (v + graphCenter x) asFloat ].
b.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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



On Dec 19, 2017, at 3:05 PM, Alexandre Bergel <[hidden email]> wrote:

Hi Evan,

Roassal assumes to have 0 @ 0. However, you do a manual translation that works very well. Check this:

data := #(1000 1001 1002). 
b := RTGrapher new. 
ds := RTData new. 
ds points: data. 
ds x: [ :c | c - 1000]. 
ds y: [ :c | c - 1000 ].
b add: ds. 
b axisX labelConversion: [ :v | (v + 1000) asFloat ].
b axisY labelConversion: [ :v | (v + 1000) asFloat ].
b.
-=-=-=-=-=-=-=-=-=-=-=-=
<Screenshot 2017-12-19 15.02.07.png>

The idea is to subtract a value using #x: and #y:, and then add it in #labelConversion:

Let us know how it goes

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



On Dec 19, 2017, at 12:44 PM, Evan Donahue <[hidden email]> wrote:

Does anyone know how to change the min/max of the axes? I'm trying to figure out how to make x and y not start at 0.

data := #(1000 1001 1002).
b := RTGrapher new.
ds := RTData new.
ds points: data.
ds x: [ :c | c ].
ds y: [ :c | c ].
b add: ds.
b minX: 999.
b maxX: 1003.
b minY: 999.
b maxY: 1003.
b.

^ this does not do what I was expecting. If the data is all clustered together but far from zero, I'd like to adjust the axes so I can see the actual variation in the data, and not just a single point where everything is clustered. What is the right way to do this?

Thanks,
Evan


Reply | Threaded
Open this post in threaded view
|

Re: Roassal Axes

abergel
Sorry, here is the correct script:
-=-=-=-=-=-=-=-=-=
"This example shows how to control the center of the graph.
Roassal assumes to have 0 @ 0, however you can subtract a value using #x: and #y:, and then add it in #labelConversion: to move the center of the graph"
graphCenter := 5 @ 10.
data := (-3.1415 to: 3.1415 by: 0.1) collect: [ :x |  x @ (x sin * 3 + 10) ]. 
b := RTGrapher new. 
ds := RTData new.
ds noDot; connectColor: Color blue. 
ds points: data. 
ds x: [ :p | p x - graphCenter x ]. 
ds y: [ :p | p y - graphCenter y ].
b add: ds. 
b axisX labelConversion: [ :v | (v + graphCenter x) asFloat round: 2 ].
b axisY labelConversion: [ :v | (v + graphCenter x) asFloat round: 2 ].
b.
-=-=-=-=-=-=-=-=-=

Alexandre


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



On Dec 19, 2017, at 3:17 PM, Alexandre Bergel <[hidden email]> wrote:

Another example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"This example shows how to control the center of the graph.
Roassal assumes to have 0 @ 0, however you can subtract a value using #x: and #y:, and then add it in #labelConversion: to move the center of the graph"
graphCenter := 5 @ 10.
data := (-3.1415 to: 3.1415 by: 0.1) collect: [ :x |  x @ (x sin * 3 + 10) ]. 
b := RTGrapher new. 
ds := RTData new.
ds noDot; connectColor: Roassal2.Color blue. 
ds points: data. 
ds x: [ :p | p x - graphCenter x ]. 
ds y: [ :p | p y - graphCenter y ].
b add: ds. 
b axisX labelConversion: [ :v | (v + graphCenter x) asFloat ].
b axisY labelConversion: [ :v | (v + graphCenter x) asFloat ].
b.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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



On Dec 19, 2017, at 3:05 PM, Alexandre Bergel <[hidden email]> wrote:

Hi Evan,

Roassal assumes to have 0 @ 0. However, you do a manual translation that works very well. Check this:

data := #(1000 1001 1002). 
b := RTGrapher new. 
ds := RTData new. 
ds points: data. 
ds x: [ :c | c - 1000]. 
ds y: [ :c | c - 1000 ].
b add: ds. 
b axisX labelConversion: [ :v | (v + 1000) asFloat ].
b axisY labelConversion: [ :v | (v + 1000) asFloat ].
b.
-=-=-=-=-=-=-=-=-=-=-=-=
<Screenshot 2017-12-19 15.02.07.png>

The idea is to subtract a value using #x: and #y:, and then add it in #labelConversion:

Let us know how it goes

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



On Dec 19, 2017, at 12:44 PM, Evan Donahue <[hidden email]> wrote:

Does anyone know how to change the min/max of the axes? I'm trying to figure out how to make x and y not start at 0.

data := #(1000 1001 1002).
b := RTGrapher new.
ds := RTData new.
ds points: data.
ds x: [ :c | c ].
ds y: [ :c | c ].
b add: ds.
b minX: 999.
b maxX: 1003.
b minY: 999.
b maxY: 1003.
b.

^ this does not do what I was expecting. If the data is all clustered together but far from zero, I'd like to adjust the axes so I can see the actual variation in the data, and not just a single point where everything is clustered. What is the right way to do this?

Thanks,
Evan