Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:11:49+00:00 2026-05-15T17:11:49+00:00

I am using scipy-cluster in my application. It provides a function to plot a

  • 0

I am using scipy-cluster in my application. It provides a function to plot a dendrogram of the hierarchical cluster tree. Looking at the source I find that it eventually plots the dendrogram by calling draw_if_interactive. As one would expect, this works fine in an interactive session, but when I run the script non-interactively, a window pops up and immediately vanishes again (I have configured matplotlib to use the macosx-backend). I need a way to either make my application wait until the user closes the window showing the plot, or to make it render directly into a file (which actually I would prefer). Again, the problem is, that I cannot modify the code that generates the plot, so the solution will probably involve some configuration settings for matplotlib or something like that.

EDIT: I added my current workaround as an answer, so others may use it. Since it is very ugly, I will leave this question open hoping for someone to come up with a better solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:11:50+00:00Added an answer on May 15, 2026 at 5:11 pm

    So, here is what I came up with for now:

    class myplot(object):
        def __init__(self, filename):
            self._filename = filename
    
        def resetFileName(self, fileName):
            self._filename = fileName
    
        def __call__(self):
            matplotlib.pylab.savefig(self._filename)
    
    plotfunction = myplot("foo.png")
    matplotlib.pylab.draw_if_interactive = plotfunction
    

    This must be executed after the hcluster-module is imported. This is ugly in many ways, but at least (thanks to the dynamic nature of Python) I do not have to modify the source-code. It let’s me set the filename for each plot, and that is just what I need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 529k
  • Answers 529k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For anybody wasting time debugging su a issues - make… May 16, 2026 at 11:15 pm
  • Editorial Team
    Editorial Team added an answer Alright, it looks like the problem is related to the… May 16, 2026 at 11:15 pm
  • Editorial Team
    Editorial Team added an answer Firstly, if you want it removed because you want to… May 16, 2026 at 11:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Using scipy's interpolate.splprep function get a parametric spline on parameter u , but the
I am currently using scipy's linregress function for single regression. I am unable to
I am trying to do a fit to a given function using Scipy. Scipy.optimize.leastsq
How can I run hierarchical clustering on a correlation matrix in scipy / numpy
I am using Scipy to construct a large, sparse (250k X 250k) co-occurrence matrix
When load matrices from mat file in python using scipy.io , it makes dictionary
I am trying to read a *.wav file using scipy. I do the following:
I'm trying to compute the laplacian of a 2d field A using scipy.ndimage.convolve .
I am looking to seasonally adjust monthly data, using Python. As you can see
Using jQuery's UI Tabs. This is my code. <div id=tabs> <ul> <li><a href=#tabs-1>Find a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.