ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 05 Sep 2017 04:31:34 -0500Empty graph using implicit_plot3d with contour-optionhttp://ask.sagemath.org/question/38741/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!osTue, 05 Sep 2017 04:31:34 -0500http://ask.sagemath.org/question/38741/3d isosurface contour plot from list/3d matrixhttp://ask.sagemath.org/question/38451/3d-isosurface-contour-plot-from-list3d-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.
osMon, 31 Jul 2017 09:38:09 -0500http://ask.sagemath.org/question/38451/The boundary of an implicit_plot3d are jittery.http://ask.sagemath.org/question/24370/the-boundary-of-an-implicit_plot3d-are-jittery/ I am making a contour plot in a restricted region using the following commands:
var('x,y,z')
implicit_plot3d((x^2+y^2-.4)*(x^2+z^2-.4)*(z^2+y^2-.4)*(x^2+(y-z)^2/2-.4)*(z^2+(x-y)^2/2-.4)*(y^2+(x-z)^2/2-.4)*(x^2+(y+z)^2/2-.4)*(z^2+(x+y)^2/2-.4)*(y^2+(x+z)^2/2-.4)==1, (x, -3, 3), (y, -3,3), (z, -3,3), color='green', plot_points=100, region=lambda x,y,z: x^2+y^2+z^2<10)
The surface is restricted to a ball, using the region command. This is because I need to illustrate a surface with its boundary meeting the corresponding sphere.
My problem is that some of the boundary cylinders have their border very jittery. They look like a saw. I need them to be smooth, as some others actually are.
I tried using Adaptative=true, without any success. The same problem also applies when I use tachyon to render rather than jmol.
Any suggestions would be welcome.
Thank you
alexgWed, 01 Oct 2014 18:53:42 -0500http://ask.sagemath.org/question/24370/can I create isosurface contours from list data?http://ask.sagemath.org/question/10113/can-i-create-isosurface-contours-from-list-data/I've recently started playing with sage 3d plotting. I was wondering if there was any way I can make 3D isosurface contour plots from list data. I'm able to take 2D matrix data and make 3D surface plots using list_plot3d. But I want to take 3D matrix data and make isosurface contour plots in a way similar to mayavi's contour3d function.Young LeeSat, 11 May 2013 05:13:21 -0500http://ask.sagemath.org/question/10113/