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 7036389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:25:06+00:00 2026-05-28T01:25:06+00:00

I’m using python with matplotlib to create plots out of data, an I’d like

  • 0

I’m using python with matplotlib to create plots out of data, an I’d like to save this plots on a pdf file (but I could use also a more specific format).
I’m using basically this instructions:

plt.plot(data)
figname = ''.join([filename, '_', label, '.pdf'])
plt.savefig(figname)

But what this does is create an image of the plot with the zoom in which it’s displayed; I would like to create a copy that shows all points (>10000) that I’m plotting so I would be able to zoom to any level.
Which is the correct way to do that?

EDIT: is there a format (such as ‘.fig’ for Matlab) that calls directly the viewer of Matplotlib with the data i saved?
Maybe it’s possible to create a .py script that saves the points and that i can call to quickly re-display them? I think that this is what is done by the .fig Matlab file.

This is the detail of the plot exported as pdf

And this is what I would like to obtain, still being able to see the whole plot, that is bigger

  • 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-05-28T01:25:07+00:00Added an answer on May 28, 2026 at 1:25 am

    I don’t know of any native Matplotlib file format which includes your data; in fact, I’m not sure the Matploblib objects even have a write function defined.

    What I do instead to simulate the Matlab .fig concept is to save the processed data (as a numpy array, or pickled) and run a separate .py script to recreate the Matplotlib plots.

    So in steps:

    1. Process your data and make some pretty plots until you are fully content
    2. Save/pickle your processed data as close to the plot commands as possible (you might even want to store the data going into a histogram if making the histogram takes a long time)
    3. Write a new script in which you import the data and copy/paste the plotting commands from the original script

    It is a bit clumsy, but it works. If you really want, you could embed the pickled data as a string in your plotting script (Embed pickle (or arbitrary) data in python script). This gives you the benefit of working with a single python script containing both the data as well as the plotting code.

    Edit

    You can check for the existence of your stored processed data file and skip the processing steps if this file exists. So:

    if not processed_data.file exists:
       my_data = process_raw_data()
    else:
       my_data = read_data_from_file(processed_data.file)
    
    plot(my_data)
    

    In this way, you can have one script for both creating the graph in the first place, and re-plotting the graph using pre-processed data.

    You might want to add a runtime argument for forcing a re-processing of the data in case you change something to the processing script and don’t want to manually remove your processed data file.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I want to construct a data frame in an Rcpp function, but when I
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.