Ask Your Question

os's profile - activity

2019-11-13 21:48:08 +0100 received badge  Popular Question (source)
2017-09-09 15:45:33 +0100 commented answer Empty graph using implicit_plot3d with contour-option

Thank you for your ideas! I do not think it is because of the interpolation; commenting out the lines test =... test.show() and starting sage takes about 2 seconds for the whole process (n=2). The trick with the brackets [()] doesn't seem to have any impact, for n=2 with and without brackets sage needs about 2 minutes on my computer. Later I will try the matplotlib contour3D function (not sure if they are suited to this problem), maybe they are faster... (http://matplotlib.org/mpl_toolkits/mp...)

2017-09-09 09:34:29 +0100 received badge  Scholar (source)
2017-09-09 09:34:18 +0100 received badge  Supporter (source)
2017-09-09 09:34:13 +0100 commented answer Empty graph using implicit_plot3d with contour-option

Thank you very much for your answer, I wasn't familiar with lambda functions. However, I am still a little bit confused, why it takes so long to make the implicit_plot3d. In mathematica the in my opinion equivalent function would be ContourPlot3D (http://reference.wolfram.com/language...). I already used it to plot interpolated functions to 50x50x50 matrices and it seems to be considerably faster, or in other words with implicit_plot3D it doesn't seem to be possible to do that for n=50. Any ideas on that? Ps. I think it should be numpy.linspace instead of np.linspace (line 7)

2017-09-05 14:02:13 +0100 received badge  Student (source)
2017-09-05 11:31:34 +0100 asked a question Empty graph using implicit_plot3d with contour-option

Hello everybody,

I wanted to make an isosurface plot from a 3d matrix, which contains random values from 0 to 1 at an equally spaced 3d grid.

Therefore I generated random numbers, and reshaped them in a 3d matrix. I interpolated the 3d matrix linearly with the RegularGridInterpolator from scipy. To make a 3D plot of it I am using the implicit_plot3d function of sage with a given contour value.

I get no errors, but in the end the graph is empty, which should not be in my opinion.

Here is my code:

from scipy.interpolate import griddata
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import scipy.interpolate 

numbers=np.random.random_sample((1000,)) #generate random numbers
#print numbers

data = np.reshape(numbers, (10, 10, 10))  #reshape the numbers on a 3D matrix
#print data

xi = yi = zi = np.linspace(1, 10, 10)
interp = scipy.interpolate.RegularGridInterpolator((xi,yi,zi), data) #interpolate the 3d matrix with a function

#print xi

var('x,y,z')
#test = implicit_plot3d(interp,(x,1,10),(y,1,10),(z,1,10),contour=0.5)
test = implicit_plot3d(interp==0.5,(x,1,10), (y,1,10),(z,1,10),plot_points=60, color='seagreen') 
test.show() #plot the the function at a certain value

#a=(5.,5.,2.)
#interp(a)

Any ideas on that?

Thank you very much!

2017-08-01 17:52:45 +0100 asked a question 3d isosurface contour plot from list/3d matrix

I want to make a 3d isosurface contour plot from 3d matrix data. Since the mayavi package, as far as I know, isn't compatible with python 3, I can't use it anymore.

The only way which should work, is opening an interface to GNU octave, which is able to make such plots. What I would like to know, if there exist easier ways to do that.