How to reduce time of savefig()

I’m using matplotlib to drawing a picture and save as ‘pdf’ file.
I’m using ‘pdf’ backend. I have tried to use ‘cairo’ backend which can speed up savefig() function, however this backend does not meet our requirements.
How can I reduce the time to within 30 seconds.

Hard to say - depends on what you are plotting. I’ve found that if I do a large pcolormesh, then rasterizing it really helps.