8000 segmentation fault when plotting large number of images · Issue #5795 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
segmentation fault when plotting large number of images #5795
Closed
@ProkopHapala

Description

@ProkopHapala

Hello, when I plot few hundred of images the matplotlib crash with segmentation fault. This is the minimal code which reproduce the error ( I generate random 3D datagrids and then plot each slice and store figure to file ):

import numpy as np
import matplotlib.pyplot as plt

default_figsize = (3,3)

def plotImages( prefix, F, figsize=default_figsize ):
    slices = range( len( F ) )
    for ii,i in enumerate(slices):
        print " plotting ", i
        plt.figure( figsize=figsize )
        plt.imshow( F[i], origin='image' )
        plt.title( r"iz = %i" %i  )
        plt.savefig( prefix+'_%3.3i.png' %i, bbox_inches='tight' )
        plt.close()


nx = 500
ny = 500
nz = 100
ng = 100

for i in range( ng ):
    F = np.random.randn( nz,ny,nx )
    print "NEW GRID ", i , " : ", np.shape(F)
    plotImages( "", F )
    del F

in this case the error happened after at grid 12 image 54 ( i.e. 11*100 + 54 = 1154 images ). But the exact point of crash depends on many parameters (size of grids, size of images, and probably also memory usage on my machine ). I do not know how to trace it.

I originaly asked this as github question:
http://stackoverflow.com/questions/34592311/matplotlib-segmentation-fault-when-plotting-large-number-of-images

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0