Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've run Seaborn's clustermap and saved the result into a ClusterGrid object named "test". However due to some unknown reason that command didn't show the clustermap unless I run it again, although the "test" isn't empty. It is indeed a ClusterGrid object.

So is there any simple way to show/plot the ClusterGrid since I've saved it? I tried plt.plot but it didn't work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
149 views
Welcome To Ask or Share your Answers For Others

1 Answer

Typing dir(test) should show you methods and attributes of the seaborn.matrix.ClusterGrid. (seaborn.matrix.ClusterGrid is what you should see if you type type(test).) Among the list are two items, fig and savefig.

test.fig will allow you to display the plot again any cell below the one that generated it, assuming %matplotlib inline was invoked earlier. So if it is displaying unreliably in the generating cell, put a cell with test.fig right below that one and you'll see it.

test.savefig("test_plot.png") should save the plot as an image file. You can use code to show that image with from IPython.display import Image; Image("test_plot_.png"), and that will get embedded in the saved notebook and shown subsequently in static renders.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...