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

  • Home
  • SEARCH
  • 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 6962751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:42:03+00:00 2026-05-27T15:42:03+00:00

I have an embedded matplotlib plot in a PyQt4 application. This is the plotting

  • 0

I have an embedded matplotlib plot in a PyQt4 application. This is the plotting widget I have made based on the Qt4 embedding sample at http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html. Unfortunately, every time I add a new plot, this graph shrinks slightly. I have two plot widgets aligned side by side in a QGridLayout if that makes a difference.

What could the reason for this weird behaviour be?

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

class MultiPlot(FigureCanvas):
    def __init__(self, parent=None, width=5, height=4, dpi=100):
        fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = fig.add_subplot(111)
        FigureCanvas.__init__(self, fig)
        self.setParent(parent)
        self.setMinimumSize(300, 200)
        self.setMaximumSize(600, 400)

    def plot(self,x,y):
        print "Plot"
        self.axes.plot(x,y)
        FigureCanvas.updateGeometry(self)

    def changePlot(self,plotNum,x,y):
        print "Change plot",plotNum
        self.axes.lines[plotNum].set_data(x,y)
        FigureCanvas.updateGeometry(self)
  • 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-27T15:42:03+00:00Added an answer on May 27, 2026 at 3:42 pm

    I fixed this using setFixedSize on the widget instead of allowing the layout manager to resize. I dont understand why the layout manager would want to shrink the widget when more plots were added but the problem is fixed anyway

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

Sidebar

Related Questions

I have embedded an IronPython engine in a C# application. I want to expose
I have embedded Lua in an Objective-C application using LuaObjCBridge. I need to know
I have a page with multiple Matplotlib figures embedded. The figures get inserted/manipulated via
I have embedded some crystal reports in my C# application. The problem is, compiling
We have embedded JasperReports into our application to generate reports, but I've been rather
im making an iphone web based app and i have embedded a google maps
I'm trying to create a run time css-based swf which DOES NOT have embedded
I have embedded the fullcalendar jquery control by using this code: $(document).ready(function() { var
I have embedded Acrobat Reader in my WPF application, and I have defined several
I am using the Ajax Minifier http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=766 and have embedded it in the csproj

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.