Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
PlotMorph
Last updated at 9:59 pm UTC on 10 November 2023
Maintained in

 MCHttpRepository
    location: 'http://www.squeaksource.com/PlotMorph'
    user: ''
    password: ''

Original author: Diego Gomez Deck, currently maintained by various contributors. Tested in Squeak 6.1 and appears to work well.

Morph to draw XY plots. See the methods testXXX in the class side.

Try with:
 PlotMorph test.
 PlotMorph test2.
 PlotMorph test4.
 PlotMorph testWithReferences.

Look at the code behind those methods in Browser


Installation

Find in SqueakMap or simply install the latest version with Monticello

Note


See it in action


In development


Screenshots

Uploaded Image: Plot1.gif Uploaded Image: Plot2.gif Uploaded Image: Plot3.gif Uploaded Image: f-plotter.jpg

Question


Kwiyi Woo February 01, 2004: I am pretty new to squeak and tried to use plotMorph to create a curve graph. I cannot find the methods "test", "test2" or "testWithReferences" in the PlotMorph class. How can the PlotMorph send message to them. Also I don't know how to plot a curve at specified function. Could anyone give me some suggestions?


Answer
German S. Arduino:
Look at class side for these methods. What I have found (in the test4) is this:

Raymond Asselin: As you see in a SystemBrowser, 5 classes are used to make aPlotMorph:

So if you want to get rid of PlotMorphGrid you have to find where this class is used.


  function := [:x | x degreesToRadians sin / 5 + 
            ((x / 10) degreesToRadians cos + 
            (x / 10) degreesToRadians sin) * 100].
    0 to: 3000
        by: 5
        do: [:x | pm series: #test2 addPoint: x
                  & (function value: x)].
    pm openInWorld  3

where a mathematical function is defined within a bloc
[ :x | x blabla....]
and assigned to the variable function to be used in the loop below where the y value of a point is compute with that function . So, if you change the mathematical function in that bloc you'll have the result you are looking for.

Kwiyi Woo: I got the idea and successfully created my own graph. Thanks. But now I am trying to remove te grid on the Axis coordinators. In other words, I only want to keep the X and Y axis without having a grid on the background. Is there any attribute I can turn off?

One way to find this is: (1) to select the PlotMorphGrid class in the SystemBrowser and (2) to choose in the contextual menu (alt+click on a Mac // right button on Windows) the menu item Òclass refsÓ this will open a window with the Îusers1 of the selected class. You'll see that there is only one user, it is the class AxesMorph in is Îinitialize1 method. (3) Select it and you will see in the bottom pane the code. Find in which statement PlotMorphGrid is used.
grid := PlotMorphGrid on: self.


I tried
grid := self
and the result seem to be what you are looking for.

So remember to look for the class refs of a class when you want to know who uses it, or how it is used.





Related