python


Matplotlib: multiprocess with joblib


I need to compute and then plot 18 figures, so I want to do multiprocess with Matplotlib (I use joblib here). Here is the example code:
def try_plot(y):
fig = plt.figure()
ax = fig.add_subplot(111)
x=arange(1,10)
ax.plot(x, x*y)
return fig
# This works
figs = [try_plot(y) for y in arange(3)]
# This fails
from joblib import Parallel, delayed
figs = Parallel(n_jobs=-1)(delayed(try_plot)(y) for y in arange(3))
The error it gives to me is this:
Exception in thread Thread-8:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "D:\ProgramData\Anaconda3\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 429, in _handle_results
task = get()
File "D:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1445, in __setstate__
mgr = plt._backend_mod.new_figure_manager_given_figure(num, self)
AttributeError: module 'ipykernel.pylab.backend_inline' has no attribute 'new_figure_manager_given_figure'
I searched around, but didn't find anyone use joblib with matplotlib, all I find is that it is possible to do multiprocessing with matplotlib, as stated in
https://matplotlib.org/2.0.0/examples/misc/multiprocess.html
Saving multiple matplotlib figures with multiprocessing

Related Links

i want your help abut program to run automatically every 12 hours
How to create a form for website, without requiring a data-model - Odoo v9 community
Qt setStyleSheet which kind of fonts can I use?
Python matching items accross dataframes
How to add colours to my python code
Flask - Getting a 304 status for my external .css file
User Domains for Office Online
Python - Django - Sum values of a list, too slow
Selenium - Select fields won't save via Remote Webdrive
Find blocks (and their sizes) of same consecutive elements in Pandas
With python dataframes add column of counts of rows that meet condition to each row that meets it
Pandas pivot_table with aggfunc works differently on little different data
`ndimage.distance_transform_bf` transforms the wrong elements?
Generate random words with different lengths
Error in alpha beta prunning algorithm in python
How to do the below task in shell script using grep but without a for loop?

Categories

HOME
sass
nlp
amazon-swf
system-verilog
textwatcher
smartphone
otrs
cocos2d-x-3.0
command
csvhelper
sbt-assembly
appmaker
rebol
height
xlsx
image-recognition
ctypes
phoenix
titan
zope
bootstrap-popover
bar-chart
ios10.3
url.action
ghost-inspector
tarantool
novnc
cronet
branch
edge-detection
helper
mayavi
reply
gzip
pari
skygear
ifstream
rhomobile
gettext
large-data
ksoap
visualstudio.testtools
web-development-server
taglib
z3py
tableau-server
azure-availability-set
number-theory
maintenance
search-box
addin-express
bettercms
gulp-typescript
android-navigationview
cjson
backstop.js
windows-nt
listadapter
nssplitview
image-editing
dbscan
codesign
supportmapfragment
inet
license-key
java.util.calendar
direct3d12
jta
eyeql
evo
android-snackbar
pyrocms
calibration
ubercart
debian-based
adobe-indesign
code-first-migrations
jai
orientation-changes
moai
belongs-to
alphablending
line-numbers
adcolony
cg
delphi-xe3
reserved-words
json-patch
facebook-chat
fluidsynth
mozart-mvc
git-filter-branch
maven-ear-plugin
vim-powerline
datarepeater
gdt
flexicious
v4l
selectonemenu
text-size
electronic-signature
ets
gethashcode
drawtext
google-instant
asp.net-mvc-controller
kpi
visual-studio-2010-beta-2
evb
data-entry
ajaxpro
data-execution-prevention

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App