Hi Hernan,
1) You can see the result in the TR Morph.png attached file. In X
axis, how can set up a tick every certain step value? For example,
every 50 points. Right now this is 88, 176, 264, 353 and I would like
to be 50, 100, 150, 200, 250, 300, 350, 400.
you can use message #shouldUseNiceLabelsForX:, this enables RTGrapher to use RTLabelGenerator, that uses nice labels for these cases.
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
| b ds |
b := RTGrapher new.
ds := RTData new.
ds points: RTShape withAllSubclasses.
ds y: #numberOfMethods.
b add: ds.
b addDecorator: RTVerticalMinValueDecorator new red.
b addDecorator: RTVerticalMaxValueDecorator new blue.
b shouldUseNiceLabelsForX: true.
b axisY noLabel.
b axisX
noDecimal;
numberOfTicks: 10;
numberOfLabels: 10.
b build.
^ b view
.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=
2) I just plotted a very short toy DNA sequence, however if I would
like to plot GC skew for E.coli that would take hundreds of points.
The following script takes ages to complete or it never ends. You will
find attached the necessary files:
| grapher ds eColiGCSkew zipArchive |
zipArchive := ZipArchive new.
[ zipArchive
readFrom: 'ecoligcskew.zip' asFileReference;
extractAllTo: '.' asFileReference ]
ensure: [ zipArchive close ].
eColiGCSkew := FLMaterializer materializeFromFileNamed:
'OrderedCollection_3712516797.obj'.
eColiGCSkew := eColiGCSkew copyFrom: 1 to: 20000.
grapher := RTGrapher new
extent: 800 @ 500;
yourself.
ds := RTData new
points: { 0@ -1000. eColiGCSkew size@ 1000};
y: #y;
x: #x;
yourself.
grapher add: ds.
grapher addDecorator: (RTAreaDecorator new
points: eColiGCSkew;
color: Color orange trans).
grapher shouldUseNiceLabelsForX: true.
grapher axisY
minValue: eColiGCSkew min;
title: 'Skew';
color: Color black;
noDecimal.
grapher axisX
numberOfTicks: 10;
noDecimal;
color: Color black;
title: 'Position'.
grapher
The eColiGCSkew is an array of 4 millon points, this in roassal creates 4 millon instances of RTElement of one ellipse. For this script I have used RTAreaDecorator, that creates a single instance of RTSVGPath, with a lot of commands that Athens can read and creates. But in this case you can:
- create a SVG with all the points, and add it to the grapher. like RTAreaDecorator.
- Draw on the same canvas: roassal in TRMorph uses a Surface to draw the elements, I think that you reuse this surface to draw each dot with one roassal shape, in order to get this kind of draw over the time(the time that takes to iterate the 4 millon points) https://www.openprocessing.org/sketch/604265
Cheers,
Milton