+ 3

P5.js not drawing all circles

I am trying to visualise a nearest neighbour classifier and for this i want to draw multiple circles but for some reason, i can only draw one. At first i tried it with a for loop which also gave the same result. https://code.sololearn.com/Wam840b1HIZt/?ref=app

30th Jul 2019, 1:11 PM
Julian
Julian - avatar
3 Réponses
+ 6
Julian There are more circles, but the canvas is too small. You have to set the width and height of the canvas with createCanvas(innerWidth, innerHeight) and the rest of the circles will be visible too. 🌹🌹 Edit: at least the 2 green circles appear. I dont see any red circles, so either you have another error in your code, or they are still outside the scope of the screen... 🤔
31st Jul 2019, 5:47 AM
marjel101
marjel101 - avatar
+ 2
the red circles have negative coordinates. No size of canvas will display that, so they’d better have positive coords if you want them displayed
31st Jul 2019, 3:55 PM
Jason Stone
Jason Stone - avatar
30th Jul 2019, 9:34 PM
Gordon
Gordon - avatar