@@ -63,7 +63,9 @@ def SpaceMatplotlib(
63
63
elif space is None and propertylayer_portrayal :
64
64
draw_property_layers (space_ax , space , propertylayer_portrayal , model )
65
65
66
- solara .FigureMatplotlib (space_fig , format = "png" , dependencies = dependencies )
66
+ solara .FigureMatplotlib (
67
+ space_fig , format = "png" , bbox_inches = "tight" , dependencies = dependencies
68
+ )
67
69
68
70
69
71
def draw_property_layers (ax , space , propertylayer_portrayal , model ):
@@ -327,11 +329,14 @@ def PlotMatplotlib(model, measure, dependencies: list[any] | None = None):
327
329
elif isinstance (measure , dict ):
328
330
for m , color in measure .items ():
329
331
ax .plot (df .loc [:, m ], label = m , color = color )
330
- fig .legend ()
332
+ ax .legend (loc = "best" )
331
333
elif isinstance (measure , list | tuple ):
332
334
for m in measure :
333
335
ax .plot (df .loc [:, m ], label = m )
334
- fig .legend ()
336
+ ax .legend (loc = "best" )
337
+ ax .set_xlabel ("Step" )
335
338
# Set integer x axis
336
339
ax .xaxis .set_major_locator (plt .MaxNLocator (integer = True ))
337
- solara .FigureMatplotlib (fig , dependencies = dependencies )
340
+ solara .FigureMatplotlib (
341
+ fig , format = "png" , bbox_inches = "tight" , dependencies = dependencies
342
+ )
0 commit comments