plot a single point how?
kalle last edited by
There is a line command to plot a line but no command to plot a point. Something like set point(x,y) is not available ? The workaround I use is the command for oval.
But the effect is that the drawing takes a lot of time...
some suggestion to improve would be helpful. EXAMPLE:
xscreen = 640 yscreen = 480 newPage(xscreen,yscreen) def f(p, k) : fwert = p + k * p * (1 - p) return fwert def input(): global left, right, bottom, top global invisible, visible left = 1.8 right = 3.0 bottom = 0.0 top = 1.5 invisible = 200 visible = 200 def setup(): input() feigenbaumIteration() saveImage("~/Desktop/feigenbaum.png") def setglobalpoint(xw, yw): x = (xw - left) * xscreen / (right - left) y = (yw - bottom) * yscreen / (top - bottom) oval(round(x),round(y),1,1) def feigenbaumIteration(): deltaxPerPixel = (right - left) / xscreen for section in range(0, xscreen+1, 1): coupling = left + section * deltaxPerPixel population = 0.3 for i in range(0, invisible+1, 1): population = f(population, coupling) for i in range(0, visible+1, 1): setglobalpoint(coupling, population) population = f(population, coupling) setup()
there is a work around
# create a bezierPath # this could collect all the points you want to show p = BezierPath() # add a point by moveTo and lineTo the same point p.moveTo((100, 100)) p.lineTo((100, 100)) # add an other point p.moveTo((100, 230)) p.lineTo((100, 230)) # set a stroke width strokeWidth(28) # set a line cap lineCap("round") # set a stroke color stroke(0) # draw the path drawPath(p)
an example with a lot of random points
p = BezierPath() for i in range(5000): x = random() * width() y = random() * height() p.moveTo((x, y)) p.lineTo((x, y)) strokeWidth(10) lineCap("round") stroke(0) drawPath(p)