Hi,
I think it might be very helpful if the variable explorer can show the sparse matrix. Right now only ndarray are supported. Along with it there could be a spy option in the menu.
Optional: maybe a convert to ndarray and convert to sparse can be added in the corresponding variable menu.
Thanks for the consideration.
I would like to share my temporary solution. But this should be considered as a "solution" to it.(my spyder version 3.2.1)
is_supported of file widgets/variableexplorer/utils.py def is_supported(value, check_all=False, filters=None, iterate=True):
"""Return True if the value is supported, False otherwise"""
import scipy.sparse as sps
if isinstance(value, sps.spmatrix):
return True
# ...
value_to_display function in the same fileelif isinstance(value, scipy.sparse.spmatrix):
display = 'nnz: %i, Min: %r\n Max: %r' %(value.nnz, value.min(), value.max())
and in get_size
elif isinstance(item, (ndarray, MaskedArray, scipy.sparse.spmatrix)):
return item.shape
imshow method in namespacebrowser.pydef imshow(self, name):
sw = self.shellwidget
import scipy
try:
sw.execute("%%varexp --spy %s" % name)
except:
if sw._reading:
sw.dbg_exec_magic('varexp', '--imshow %s' % name)
else:
sw.execute("%%varexp --imshow %s" % name)
refresh_plot_entries functions in the collections editorelse:
is_array = condition_plot = condition_imshow = is_list \
= condition_hist = False
condition_imshow = True # my code here
self.plot_action.setVisible(condition_plot or is_list)
This gives me the desired feature I want.


Hi @kailaix thanks for sharing your solution!, if you want maybe you could create a PR with this changes and then we could give you some comments on the code. @ccordoba12 @goanpeca @jitseniesen , what do you guys think?
Sure, go for it :-)
+1 from me too. @kailaix, please go for it!
Our only requirement is to make this against our master branch because Spyder 3.2 is now in maintenance, so we don't accept new features for it.
Most helpful comment
I would like to share my temporary solution. But this should be considered as a "solution" to it.(my spyder version 3.2.1)
is_supportedof filewidgets/variableexplorer/utils.pyvalue_to_displayfunction in the same fileand in
get_sizeimshowmethod innamespacebrowser.pyrefresh_plot_entriesfunctions in the collections editorThis gives me the desired feature I want.