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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:28:02+00:00 2026-05-15T09:28:02+00:00

I have some surface data that is generated by an external program as XYZ

  • 0

I have some surface data that is generated by an external program as XYZ values. I want to create the following graphs, using matplotlib:

  • Surface plot
  • Contour plot
  • Contour plot overlayed with a surface plot

I have looked at several examples for plotting surfaces and contours in matplotlib – however, the Z values seems to be a function of X and Y i.e. Y ~ f(X,Y).

I assume that I will somehow need to transform my Y variables, but I have not seen any example yet, that shows how to do this.

So, my question is this: given a set of (X,Y,Z) points, how may I generate Surface and contour plots from that data?

BTW, just to clarify, I do NOT want to create scatter plots. Also although I mentioned matplotlib in the title, I am not averse to using rpy(2), if that will allow me to create these charts.

  • 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-15T09:28:02+00:00Added an answer on May 15, 2026 at 9:28 am

    for do a contour plot you need interpolate your data to a regular grid http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data

    a quick example:

    >>> xi = linspace(min(X), max(X))
    >>> yi = linspace(min(Y), max(Y))
    >>> zi = griddata(X, Y, Z, xi, yi)
    >>> contour(xi, yi, zi)
    

    for the surface http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html

    >>> from mpl_toolkits.mplot3d import Axes3D
    >>> fig = figure()
    >>> ax = Axes3D(fig)
    >>> xim, yim = meshgrid(xi, yi)
    >>> ax.plot_surface(xim, yim, zi)
    >>> show()
    
    >>> help(meshgrid(x, y))
        Return coordinate matrices from two coordinate vectors.
        [...]
        Examples
        --------
        >>> X, Y = np.meshgrid([1,2,3], [4,5,6,7])
        >>> X
        array([[1, 2, 3],
               [1, 2, 3],
               [1, 2, 3],
               [1, 2, 3]])
        >>> Y
        array([[4, 4, 4],
               [5, 5, 5],
               [6, 6, 6],
               [7, 7, 7]])
    

    contour in 3D http://matplotlib.sourceforge.net/examples/mplot3d/contour3d_demo.html

    >>> fig = figure()
    >>> ax = Axes3D(fig)
    >>> ax.contour(xi, yi, zi) # ax.contourf for filled contours
    >>> show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Thanks for the comments Till/Jon, Ive managed to fix this… May 16, 2026 at 11:47 am
  • Editorial Team
    Editorial Team added an answer Inetget() supports background download (your script will continue its work… May 16, 2026 at 11:47 am
  • Editorial Team
    Editorial Team added an answer set width on #nav-primary .wrapper css class to 980px(which is… May 16, 2026 at 11:47 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some automatic de-serialization code that will set an object's properties using KVC
I have some trivial markup that looks like the following: <li class=someclass> <=% t'model.attr'
I've got a bunch of data for 3-D surface plots. I want to build
I have a set of 3d points that approximate a surface. Each point, however,
I have some javascript code that is used in a few different pages in
I have a Yes linkbutton that trigger a popup (ModalPopUpExtender) The popup contain a
I have a Silverlight application that consists of a MainWindow and several classes which
I have some objects which I draw onto a Canvas as part of a
I have some difficulties grasping some concepts. Grateful for help. Let's say you have
I have some asynchronous operations being performed on the main thread of my application.

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.