Skip to content

memory error using savefig with ylim to create pdf of box plots #10889

Closed
@bu22dee

Description

@bu22dee

Bug report

Bug summary

This is my first post. I am working with python for 3 weeks and i am completly new to this topic

savefig while using ylim for box plots gives sometimes a memory error. saveing as png or svg, or not using ylim workes fine.

my guess: despite of limiting the plot with ylim savefig just "zoom" in which can create very long distances even they are not part of the plot anymore which just hit some pdf limitations. in this case there is a data point at 1e39. when i use ylim(-2,2) there is a huge distence which is not part of the plot maybe this causes the memory error.

ram was fine the whole time.

i hope this helps.

code in comments

Actual outcome

PS D:\Users\user\Documents\s_line_messdaten\vorlage> py .\vorlage.py
1_box_plot: quantity1
2_box_plot: quantity2
Traceback (most recent call last):
  File ".\vorlage.py", line 173, in <module>
    box_plot(data)
  File ".\vorlage.py", line 146, in box_plot
    plt.savefig("./boxplot/"+simplename[quantity]+'.pdf', dpi=2)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\pyplot.py", line 701, in savefig
    res = fig.savefig(*args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\figure.py", line 1834, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backend_bases.py", line 2267, in print_figure
    **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_pdf.py", line 2592, in print_pd
f
    self.figure.draw(renderer)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\figure.py", line 1299, in draw
    renderer, self, artists, self.suppressComposite)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\image.py", line 138, in _draw_list_compositing_i
mages
    a.draw(renderer)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\axes\_base.py", line 2437, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\image.py", line 138, in _draw_list_compositing_i
mages
    a.draw(renderer)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\lines.py", line 840, in draw
    rgbaFace)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_pdf.py", line 1799, in draw_mar
kers
    path, trans, rgbFace)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backend_bases.py", line 328, in draw_markers
    rgbFace)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_pdf.py", line 1719, in draw_pat
h
    gc.get_sketch_params())
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_pdf.py", line 1521, in writePat
h
    sketch=sketch)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_pdf.py", line 1511, in pathOper
ations
    True))]
MemoryError: Memory error

Expected outcome

pdf files for all plots

Matplotlib version

  • Operating system: Win 7
  • Matplotlib version: 2.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.6
  • Jupyter version (if applicable): ---
  • Other libraries: numpy (but should not be relevant)

i am at work i think it was installed via pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions