Plotter : In Jupyter & save

1/I have tried to use plotter in Jupyter but nothing appears.
Same code in VC; it works.

2/ plotter.save(“plot.png”) is not saving the plot but a blank picture.

Thanks
E

from compas.geometry import Point
from compas_plotters import Plotter
point = Point(0, 0, 0)
point2 = Point(1,1,1)
plotter = Plotter()
plotter.add(point, size=10, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.add(point2, size=5, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.zoom_extents()
plotter.show()
plotter.save(“plot.png”)

hi,

you can not do show and save in the same script. it is one of the two.

use this for displaying a plot window.

from compas.geometry import Point
from compas_plotters import Plotter

point = Point(0, 0, 0)
point2 = Point(1,1,1)
plotter = Plotter()
plotter.add(point, size=10, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.add(point2, size=5, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.zoom_extents()
plotter.show()

and this for saving an image

from compas.geometry import Point
from compas_plotters import Plotter

point = Point(0, 0, 0)
point2 = Point(1,1,1)
plotter = Plotter()
plotter.add(point, size=10, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.add(point2, size=5, facecolor=(1.0, 0.7, 0.7), edgecolor=(1.0, 0, 0))
plotter.zoom_extents()
plotter.save('plot.png')
2 Likes