I’m stuck with plotting: How do I specify number and intervals for vertical lines on my x-axis?
I tried around with the grid argument of a ControlSpec for Plot’s domainSpecs which seems to need GridLines (which again needs a ControlSpec) but I don’t succeed.
Anyone got experience in this?
Here’s a draft setting grids for every 5th value(?)
I’ve spent a lot of time on this and can’t seem to find a good solution…
Setting .domainSpec won’t help you. If you do set it to 5, it changes the way the data is plotted, not the grid lines. Observe:
d = Array.fill(128, { 0.rrand(60.0) }); //data
a = d.plot.domainSpecs_([0,128,\lin,5].asSpec);
I think you need to include the DrawGrid in the drawFunc method of the Plotter or its window, but I still don’t have it working. The best I can get is still grid lines at 50.
Unfortunately, it looks like the grid lines are automagically generated based on the data bounds.
Taking a quick look, instance methods can be used to generate the list of grid lines of different densities, but the GridLines object doesn’t have a numTicks member or something similar, so doesn’t seem settable in a practical sense
In fact, DrawGridX, for example, doesn’t even call the relevant method with the numTicks argument, so it will always default to nil, meaning the number of ticks will be