8000 ENH: Add a rich display hook to Cycler. · danielballan/matplotlib@14df70f · GitHub
[go: up one dir, main page]

Skip to content

Commit 14df70f

Browse files
committed
ENH: Add a rich display hook to Cycler.
1 parent c76b976 commit 14df70f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/cycler.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ def __repr__(self):
163163
msg = "({left!r} {op} {right!r})"
164164
return msg.format(left=self._left, op=op, right=self._right)
165165

166+
def _repr_html_(self):
167+
# an table showing the value of each key through a full cycle
168+
output = "<table>"
169+
for key in self.keys:
170+
output += "<th>{key!r}</th>".format(key=key)
171+
for d in iter(self):
172+
output += "<tr>"
173+
for val in d.values():
174+
output += "<td>{val!r}</td>".format(val=val)
175+
output += "</tr>"
176+
output += "</table>"
177+
return output
178+
166179
def _transpose(self):
167180
"""
168181
Internal helper function which iterates through the

0 commit comments

Comments
 (0)
0