implement antialiasing in SceneView
I’m trying to draw a simple graph but the output has no antialiasing so it looks ugly. If I drew a full scene
‘’’Scene.run(antialiasing = true) ‘’’
is a valid option. However, I’m making a custom graph class which inherits from Scene. When this is done, it isn’t necessary to pass a run() call. Is it possible to change the class to make it pass this parameter?
How do I set up antialiasing?
Here’s the a minimal working example that has a graph.
@anchovies , I know nothing about your post. But antialiasing = true does not look correct. Try antialiasing = True instead, capital 'T' for True
anti_aliasis an attribute of SceneView.
For your example, you might also increase linewidth slightly.
You might also want to try using ShapeNode, with a ui.Path.
#in setup: self.p=ShapeNode(p,parent=self) def plot(self,x,y): p=ui.Path() p.move_to(x,y) for i in range(len(x) - 1): p.line_to(x[i+1],y[i+1]) p.line_join_style=ui.LINE_JOIN_BEVEL self.p.path=p self.p.line_width=1.
This lets you set the line_join_mode (try setting your line width to like 30, and you will see the problem with your original method)
The one drawback is that this is somewhat slower.
But, you can probably plot much fewer points, or add curves instead of lines...
I completely missed that
anti_aliasattribute! That totally solved my problem!