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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:45:46+00:00 2026-06-12T15:45:46+00:00

I have a 2D array from which I want to produce a contour plot

  • 0

I have a 2D array from which I want to produce a contour plot using matplotlib. Everything works fine saving as PNG (or other raster formats), however for including the figure in a paper I need to save to postscript format.
The problem is, the file I get is quite big (some MB) when I save to postscript. It looks like Matplotlib saves everything in vector format. While this makes sense for the axes and the labels, that would be degraded if rasterized, I would like to have the contour plot itself in raster format (which I know can be embedded inside a postscript).
Does anybody know how to do it? I’m using the Agg backend.

  • 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-06-12T15:45:47+00:00Added an answer on June 12, 2026 at 3:45 pm

    OK, in the end I found the answer to my own question. It required a difficult digging in the matplotlib mailing list, so I am linking here the relevant thread in the hope it will be helpful also for someone else, and possibly easier to find (by the way, no-one replied to the poor guy who sent the message).

    I willl summarize here the idea in words. One has to use the set_rasterized method, as sega_sai suggested. However, rather than applying the method to the whole figure, as I explained in my comment, the method has to be applied to the lines that comprise the contour plot. The trick is to first create a “container” for them all and to rasterize that, instead of rasterizing each individual line (which was something I already tried and gives bad results). This works fine. In the discussion I linked you can find the code for doing it.

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

Sidebar

Related Questions

I have a UITableView which I want to populate with details from an array
I have an array of urls of images, from which i have to first
I have a function which performs a foreach loop on an array from a
I have an application in which I need to pass an array from C#
I have dynamic array filled with bytes, which are read from .raw file with
I have an indexed array which I've generated from an associative array with this
I have one main array which is the returned data from a MySQL query
I have a problem related to an array data which fetched from an external
I have a char array in Python, which is read from a file e.g.
I have this string of numbers var array = 1,6,2,9,5 which is retrieved from

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.