Skip to content

Commit

Permalink
Min code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Aug 12, 2024
1 parent 0d0906d commit 382bfa7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions MLStructFP/db/image/_rect_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ def _get_floor_plot(self, floor: 'Floor', rect: Optional['Rect'], store: bool) -
if floor_id in self._plot.keys():
return self._plot[floor_id]

fig: 'Figure'
ax: 'plt.Axes'
fig = plt.figure(frameon=False) # Don't configure dpi
fig: 'Figure' = plt.figure(frameon=False) # Don't configure dpi
plt.style.use('default') # Don't modify this either
ax = fig.add_axes([0, 0, 1, 1])
ax: 'plt.Axes' = fig.add_axes([0, 0, 1, 1])
ax.axis('off')
ax.set_aspect(aspect='equal')
ax.grid(False) # Don't enable as this may destroy the figures
Expand Down Expand Up @@ -178,7 +176,7 @@ def make_region(self, xmin: NumberType, xmax: NumberType, ymin: NumberType, ymax
plt.figure(fig.number)

# Save the figure
figname = f'{rect.id}' if rect else f'{floor.id}-x-{xmin:.2f}-{xmax:.2f}-y-{ymin:.2f}-{ymax:.2f}'
figname: str = f'{rect.id}' if rect else f'{floor.id}-x-{xmin:.2f}-{xmax:.2f}-y-{ymin:.2f}-{ymax:.2f}'

ax.set_xlim(min(xmin, xmax), max(xmin, xmax))
ax.set_ylim(min(ymin, ymax), max(ymin, ymax))
Expand Down

0 comments on commit 382bfa7

Please sign in to comment.