Skip to content

Commit af0e13e

Browse files
authored
add digits format plot (#4266)
* add digits format plot * increase codecov * increase codecov
1 parent 85f9950 commit af0e13e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

_unittest/test_02_2D_modeler.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ def test_09_plot(self):
166166
self.aedtapp.modeler.create_regular_polygon(
167167
position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", matname="Copper"
168168
)
169-
obj = self.aedtapp.plot(show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg"))
169+
obj = self.aedtapp.plot(
170+
show=False,
171+
export_path=os.path.join(self.local_scratch.path, "image.jpg"),
172+
show_bounding=True,
173+
show_grid=True,
174+
)
170175
assert os.path.exists(obj.image_file)
171176
obj2 = self.aedtapp.plot(show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg"), view="xy")
172177
assert os.path.exists(obj2.image_file)

pyaedt/generic/plot.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ def __init__(self):
730730
self._frames = []
731731
self.show_axes = True
732732
self.show_legend = True
733+
self.digits_format = "%.2e"
733734
self.show_grid = True
734735
self.is_notebook = is_notebook()
735736
self.gif_file = None
@@ -1539,7 +1540,7 @@ def plot(self, export_image_path=None):
15391540
shadow=True,
15401541
n_labels=9,
15411542
italic=True,
1542-
fmt="%.1f",
1543+
fmt=self.digits_format,
15431544
font_family="arial",
15441545
interactive=True,
15451546
color=axes_color,
@@ -1594,7 +1595,7 @@ def plot(self, export_image_path=None):
15941595
if self.show_axes:
15951596
self.pv.show_axes()
15961597
if not self.is_notebook and self.show_grid:
1597-
self.pv.show_grid(color=tuple(axes_color), grid=self.show_grid, fmt="%.2e")
1598+
self.pv.show_grid(color=tuple(axes_color), grid=self.show_grid, fmt=self.digits_format)
15981599
if self.bounding_box:
15991600
self.pv.add_bounding_box(color=tuple(axes_color))
16001601

0 commit comments

Comments
 (0)