Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
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_alias
is 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[0],y[0]) 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... -
Thanks JonB!
I completely missed that
anti_alias
attribute! That totally solved my problem!