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 <alexandre.ber...@me.com> 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 <http://www.bergel.eu/> > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > >> On Dec 19, 2017, at 3:05 PM, Alexandre Bergel <alexandre.ber...@me.com >> <mailto:alexandre.ber...@me.com>> wrote: >> >> Hi Evan, >> >> Roassal assumes to have 0 @ 0. However, you do a manual translation that >> works very well. Check this: >> >> -=-=-=-=-=-=-=-=-=-=-=-=https://www.dropbox.com/s/oun1w85ypv1kbka/Screenshot%202017-12-19%2015.02.07.png?dl=0 >> >> <https://www.dropbox.com/s/oun1w85ypv1kbka/Screenshot%202017-12-19%2015.02.07.png?dl=0> >> 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 <http://www.bergel.eu/> >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >>> On Dec 19, 2017, at 12:44 PM, Evan Donahue <emdon...@gmail.com >>> <mailto:emdon...@gmail.com>> 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 >> >