Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3134b23

Browse filesBrowse files
committed
fixing repr impl, still working on gridplot repr
1 parent 61c3098 commit 3134b23
Copy full SHA for 3134b23

File tree

Expand file treeCollapse file tree

2 files changed

+15
-14
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-14
lines changed

‎fastplotlib/graphics/_base.py

Copy file name to clipboardExpand all lines: fastplotlib/graphics/_base.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ def update_data(self, data: Any):
6363
pass
6464

6565
def __repr__(self):
66-
print("Fastplotlib " + self.__class__.__name__ + "\n")
67-
if self.name is not None:
68-
print("Graphic Name: " + self.name + "\n")
69-
print("Graphic Location: " + hex(id(self)) + "\n")
66+
title = "Fastplotlib " + self.__class__.__name__ + "\n"
67+
if self.name is None:
68+
graph_name = "Name: " + self.name + "\n"
7069
else:
71-
print("Graphic Location: " + hex(id(self)) + "\n")
72-
print("Data:\n")
73-
print(self.data)
74-
return ""
70+
graph_name = "Name: None\n"
71+
location = "Location: " + hex(id(self)) + "\n"
72+
data = str(self.data)
73+
return title + graph_name + location + data
7574

‎fastplotlib/subplot.py

Copy file name to clipboardExpand all lines: fastplotlib/subplot.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,13 @@ def __getitem__(self, name: str):
172172
raise IndexError(f"no graphic of given name, the current graphics are:\n {graphic_names}")
173173

174174
def __repr__(self):
175-
print("Fastplotlib Subplot\n")
175+
title = "Fastplotlib " + self.__class__.__name__ + "\n"
176176
if self.name is not None:
177-
print("Subplot Name: " + self.name + "\n")
178-
print("Graphics:\n------------------------------------------------------------------------")
177+
name = "Name: " + self.name + "\n"
178+
else:
179+
name = "Name: None\n"
180+
graphics = "Graphics:\n------------------------------------------------------------------------\n"
179181
for graphic in self.get_graphics():
180-
print(graphic)
181-
print("------------------------------------------------------------------------")
182-
return ""
182+
graphics += graphic.__repr__()
183+
graphics += "\n------------------------------------------------------------------------\n"
184+
return title + name + graphics

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.