Plot a 3-D surface from a table of coordinates in Python Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Python 3D Plots over non-rectangular domainCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?

Project Euler #1 in C++

Sum letters are not two different

How to write the following sign?

I am having problem understanding the behavior of below code in JavaScript

Do I really need to have a message in a novel to appeal to readers?

What would you call this weird metallic apparatus that allows you to lift people?

What does it mean that physics no longer uses mechanical models to describe phenomena?

How much damage would a cupful of neutron star matter do to the Earth?

What order were files/directories outputted in dir?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

An adverb for when you're not exaggerating

How could we fake a moon landing now?

What was the first language to use conditional keywords?

Question about debouncing - delay of state change

Crossing US/Canada Border for less than 24 hours

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

Selecting user stories during sprint planning

What is the meaning of 'breadth' in breadth first search?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

Why do we bend a book to keep it straight?

Hangman Game with C++

What is this clumpy 20-30cm high yellow-flowered plant?

Time to Settle Down!



Plot a 3-D surface from a table of coordinates in Python



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Python 3D Plots over non-rectangular domainCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?Does Python have a string 'contains' substring method?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I haven't found an answer to this yet: I have a grid defined in a text file with four columns: (lon,lat,depth,slip). Each row is a grid point.



I can generate a scatter plot of these points using the following simple code:



# Main imports:
import numpy as np
from pylab import *
from mpl_toolkits.mplot3d import Axes3D

# Read the grid:
points = np.loadtxt("grid.txt")

# Retrieve parameters from the grid:
lon = points[:,0]
lat = points[:,1]
depth = points[:,2]
slip = points[:,3]

# 3-D plot of the model:
fig = figure(1)
ax = fig.add_subplot(111, projection='3d')
p = ax.scatter(lon, lat, depth, c=slip, vmin=0, vmax=max(slip), s=30, edgecolor='none', marker='o')
fig.colorbar(p)
title("Published finite fault in 3-D")
ax.set_xlabel("Longitude [degrees]")
ax.set_ylabel("Latitude [degrees]")
ax.set_zlabel("Depth [km]")
ax.invert_zaxis()
jet()
grid()
show()


And I get the following figure:
Grid in 3-D. The color of each point represents the "slip" values.
What I want to do is to be able to interpolate those points to create a "continuous" surface grid and plot it in both 2-D and 3-D plots. Therefore, somehow I've to consider all (lon,lat,depth,slip) in the interpolation. I'd appreciate your suggestions. Thanks in advance!










share|improve this question






















  • Try tri-surface-plots

    – Sheldore
    Mar 8 at 20:42











  • It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

    – Carlos Herrera
    Mar 8 at 20:58












  • I’m sure there are many examples of trisurf out there... you just have to search for them

    – Sheldore
    Mar 8 at 21:05











  • Check this question. It depends a bit on how your data is ordered (which is unknown here).

    – ImportanceOfBeingErnest
    Mar 8 at 21:22











  • In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

    – Carlos Herrera
    Mar 8 at 21:35

















0















I haven't found an answer to this yet: I have a grid defined in a text file with four columns: (lon,lat,depth,slip). Each row is a grid point.



I can generate a scatter plot of these points using the following simple code:



# Main imports:
import numpy as np
from pylab import *
from mpl_toolkits.mplot3d import Axes3D

# Read the grid:
points = np.loadtxt("grid.txt")

# Retrieve parameters from the grid:
lon = points[:,0]
lat = points[:,1]
depth = points[:,2]
slip = points[:,3]

# 3-D plot of the model:
fig = figure(1)
ax = fig.add_subplot(111, projection='3d')
p = ax.scatter(lon, lat, depth, c=slip, vmin=0, vmax=max(slip), s=30, edgecolor='none', marker='o')
fig.colorbar(p)
title("Published finite fault in 3-D")
ax.set_xlabel("Longitude [degrees]")
ax.set_ylabel("Latitude [degrees]")
ax.set_zlabel("Depth [km]")
ax.invert_zaxis()
jet()
grid()
show()


And I get the following figure:
Grid in 3-D. The color of each point represents the "slip" values.
What I want to do is to be able to interpolate those points to create a "continuous" surface grid and plot it in both 2-D and 3-D plots. Therefore, somehow I've to consider all (lon,lat,depth,slip) in the interpolation. I'd appreciate your suggestions. Thanks in advance!










share|improve this question






















  • Try tri-surface-plots

    – Sheldore
    Mar 8 at 20:42











  • It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

    – Carlos Herrera
    Mar 8 at 20:58












  • I’m sure there are many examples of trisurf out there... you just have to search for them

    – Sheldore
    Mar 8 at 21:05











  • Check this question. It depends a bit on how your data is ordered (which is unknown here).

    – ImportanceOfBeingErnest
    Mar 8 at 21:22











  • In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

    – Carlos Herrera
    Mar 8 at 21:35













0












0








0








I haven't found an answer to this yet: I have a grid defined in a text file with four columns: (lon,lat,depth,slip). Each row is a grid point.



I can generate a scatter plot of these points using the following simple code:



# Main imports:
import numpy as np
from pylab import *
from mpl_toolkits.mplot3d import Axes3D

# Read the grid:
points = np.loadtxt("grid.txt")

# Retrieve parameters from the grid:
lon = points[:,0]
lat = points[:,1]
depth = points[:,2]
slip = points[:,3]

# 3-D plot of the model:
fig = figure(1)
ax = fig.add_subplot(111, projection='3d')
p = ax.scatter(lon, lat, depth, c=slip, vmin=0, vmax=max(slip), s=30, edgecolor='none', marker='o')
fig.colorbar(p)
title("Published finite fault in 3-D")
ax.set_xlabel("Longitude [degrees]")
ax.set_ylabel("Latitude [degrees]")
ax.set_zlabel("Depth [km]")
ax.invert_zaxis()
jet()
grid()
show()


And I get the following figure:
Grid in 3-D. The color of each point represents the "slip" values.
What I want to do is to be able to interpolate those points to create a "continuous" surface grid and plot it in both 2-D and 3-D plots. Therefore, somehow I've to consider all (lon,lat,depth,slip) in the interpolation. I'd appreciate your suggestions. Thanks in advance!










share|improve this question














I haven't found an answer to this yet: I have a grid defined in a text file with four columns: (lon,lat,depth,slip). Each row is a grid point.



I can generate a scatter plot of these points using the following simple code:



# Main imports:
import numpy as np
from pylab import *
from mpl_toolkits.mplot3d import Axes3D

# Read the grid:
points = np.loadtxt("grid.txt")

# Retrieve parameters from the grid:
lon = points[:,0]
lat = points[:,1]
depth = points[:,2]
slip = points[:,3]

# 3-D plot of the model:
fig = figure(1)
ax = fig.add_subplot(111, projection='3d')
p = ax.scatter(lon, lat, depth, c=slip, vmin=0, vmax=max(slip), s=30, edgecolor='none', marker='o')
fig.colorbar(p)
title("Published finite fault in 3-D")
ax.set_xlabel("Longitude [degrees]")
ax.set_ylabel("Latitude [degrees]")
ax.set_zlabel("Depth [km]")
ax.invert_zaxis()
jet()
grid()
show()


And I get the following figure:
Grid in 3-D. The color of each point represents the "slip" values.
What I want to do is to be able to interpolate those points to create a "continuous" surface grid and plot it in both 2-D and 3-D plots. Therefore, somehow I've to consider all (lon,lat,depth,slip) in the interpolation. I'd appreciate your suggestions. Thanks in advance!







python python-3.x matplotlib






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 20:41









Carlos HerreraCarlos Herrera

6016




6016












  • Try tri-surface-plots

    – Sheldore
    Mar 8 at 20:42











  • It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

    – Carlos Herrera
    Mar 8 at 20:58












  • I’m sure there are many examples of trisurf out there... you just have to search for them

    – Sheldore
    Mar 8 at 21:05











  • Check this question. It depends a bit on how your data is ordered (which is unknown here).

    – ImportanceOfBeingErnest
    Mar 8 at 21:22











  • In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

    – Carlos Herrera
    Mar 8 at 21:35

















  • Try tri-surface-plots

    – Sheldore
    Mar 8 at 20:42











  • It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

    – Carlos Herrera
    Mar 8 at 20:58












  • I’m sure there are many examples of trisurf out there... you just have to search for them

    – Sheldore
    Mar 8 at 21:05











  • Check this question. It depends a bit on how your data is ordered (which is unknown here).

    – ImportanceOfBeingErnest
    Mar 8 at 21:22











  • In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

    – Carlos Herrera
    Mar 8 at 21:35
















Try tri-surface-plots

– Sheldore
Mar 8 at 20:42





Try tri-surface-plots

– Sheldore
Mar 8 at 20:42













It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

– Carlos Herrera
Mar 8 at 20:58






It could work, but how can I account for the values in the fourth column (slip)? I'm trying to do that right now, still unsuccessfully.

– Carlos Herrera
Mar 8 at 20:58














I’m sure there are many examples of trisurf out there... you just have to search for them

– Sheldore
Mar 8 at 21:05





I’m sure there are many examples of trisurf out there... you just have to search for them

– Sheldore
Mar 8 at 21:05













Check this question. It depends a bit on how your data is ordered (which is unknown here).

– ImportanceOfBeingErnest
Mar 8 at 21:22





Check this question. It depends a bit on how your data is ordered (which is unknown here).

– ImportanceOfBeingErnest
Mar 8 at 21:22













In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

– Carlos Herrera
Mar 8 at 21:35





In my data file, none of the columns are sorted in any way. I've checked some examples of trisurf. For a 2-D plot, the 'slip' values of my data could be used in 'z'. But in a 3-D plot, the grid is a plane with an azimuth and dip, and each point has a value of 'slip' that I want to interpolate and color on the plane. That is the main difficulty.

– Carlos Herrera
Mar 8 at 21:35












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070692%2fplot-a-3-d-surface-from-a-table-of-coordinates-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070692%2fplot-a-3-d-surface-from-a-table-of-coordinates-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко