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, 11 Dec 2018 18:00:34 -0600How to make points smaller than size 1 in point3d?http://ask.sagemath.org/question/44642/how-to-make-points-smaller-than-size-1-in-point3d/I am plotting a very large number of points in 3D, which I have in a list, using point3d. Below the same behavior is simulated for randomly generated points:
>point_list = []
>for n in range(10000):
>....point_list.append((random(), random(), random()))
> pic = point3d(point_list, color='red', size=1)
> pic.save(figsize=20)
I would like the points to be *very* small, since there are so many of them. It seems that "size" can only take positive integer values. As a workaround in point2d, you can make "figsize" much bigger, and the points stay the same size in pixels, which has the effect of scaling the point size down. But in point3d, when you make "figsize" bigger, you get the same picture, bigger. Could anyone help me make the points smaller?
Additionally, the default is for each point to be displayed as a little sphere, but I want it to be just a point. Again, in point2d, the code
> pic = point2d(point_list, color='black', size=1, marker='.' )
makes this happen, but when I do this in point3d they are still little spheres, and I cannot find any documentation about changing the marker for point3d.diana.davisTue, 11 Dec 2018 18:00:34 -0600http://ask.sagemath.org/question/44642/Plotting > 10k random 3D pointshttp://ask.sagemath.org/question/44286/plotting-10k-random-3d-points/Hi,
First of all, I am new to SAGE, and only started using it today.
I want to plot 100 000 random 3D points in SAGE, and it takes a LOT of time just to plot 10 000 points.
This is the code I have:
def random_point(): return (random(), random(), random())
l = [random_point() for k in [1 .. 10000]]
s = point3d(l, size=5)
show(s, aspect_ratio=1)
I noticed that the last two lines take incredibly long each.
Then, after the `show`, when I try to interact with the graphic, it is blank. I can even show the boundbox and axes, but the plot is nowhere to be seen.
If I change to `[1 .. 100]`, everything works as intended, but this amount of points is not enough.
What should I do to accomplish effectively my goal?
I am using SAGE 8.1, installed on macOS via brew, after running `notebook()` on the command line and using the browser-based notebook.
Thank you!KayvlimWed, 14 Nov 2018 19:34:52 -0600http://ask.sagemath.org/question/44286/How does list_plot3d interpret nxn matrices?http://ask.sagemath.org/question/42091/how-does-list_plot3d-interpret-nxn-matrices/ From the [documentation](http://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/list_plot3d.html) of `list_plot3d`
>INPUT:
>v - something that defines a set of points in 3 space, for example:
> - a matrix
> - a list of 3-tuples
> - a list of lists (all of the same length) - this is treated the same as a matrix.
Intuitively I would guess that the function would only accept $3 \times n$ matrices and/or their transposes, but the first example on the document page is a plot of a five by five matrix
n = 5
m = matrix(RDF, n, [(i+j)%n for i in [1..n] for j in [1..n]])
p = list_plot3d(m)
p
**Question**: How does `list_plot3d` interpret this $5 \times 5$ matrix as a set of points in 3-space?
One might suspect that `list_plot3d` handles matrices the same was as, for example, `point3d` but this is not the case. For example, the points visualized by `point3d` do not lie on the surface given by `list_plot3d` in the above example as witnessed by
p + point3d(m, size=33)
amdallWed, 18 Apr 2018 13:34:16 -0500http://ask.sagemath.org/question/42091/Get a 3d plot with points (no surface) from a parametric_plot3d?http://ask.sagemath.org/question/10998/get-a-3d-plot-with-points-no-surface-from-a-parametric_plot3d/I would like to plot only points in a defined resolution, which I get from a `parametric_plot3d()`.
Here is my Sage code:
var('u,v')
a(u,v)=-7*sin(((u-100)/(100))*pi)^2+0.2*sin(((3*u-300)/(10))*pi)
b(u,v)=-8*cos(((u-100)/(100))*pi)+0.2*cos(((3*u-300)/(10))*pi)
c(u,v)=-12*cos(((u-100)/(100))*pi)+15*sin(((v-20)/(40))*pi)
def x(u,v):
if u < 100:
return 7*sin((u/100)*pi)^2+0.15*sin((3*u/10)*pi)
else:
return a(u,v)
def y(u,v):
if u < 100:
return 8*cos((u/100)*pi)+0.15*cos((3*u/10)*pi)
else:
return b(u,v)
def z(u,v):
if u < 100:
return 12*cos((u/100)*pi)+15*sin(((v-20)/40)*pi)
else:
return c(u,v)
p = parametric_plot3d([x,y,z], (u, 0, 200), (v, 0, 40), frame=False)
I'm looking for a result, which is similar to:
![image description](http://reference.wolfram.com/mathematica/ref/Files/ListPointPlot3D.en/O_2.gif)
So I don't need a real surface, only the points.
How can I achieve this?openscriptWed, 05 Feb 2014 20:31:16 -0600http://ask.sagemath.org/question/10998/Given a direction vector and a point, how to draw a 3d line?http://ask.sagemath.org/question/9003/given-a-direction-vector-and-a-point-how-to-draw-a-3d-line/I have a point
(-e^pi, 0, e^pi)
and a direction vector
tvec = vector((e^t * cos(t) - e^t * sin(t), e^t * sin(t) + e^t * cos(t), e^t))
How would I draw a 3d line based upon these 2 arguments?
I looked over at the documentation but I couldnt find it.dnizeticSat, 26 May 2012 04:51:13 -0500http://ask.sagemath.org/question/9003/point3d label axeshttp://ask.sagemath.org/question/8356/point3d-label-axes/Hi,
I am completely new to sage (like only a few hours) and I am trying to create a labeled plot of the results from a PCA analysis.
here is what I am doing in the sage command line:
from matplotlib.mlab import PCA
pca_info=PCA(data)
a=point3d(pca_info.Wt[:3,])
a.show()
The problem is, I need to add labels to the axes to try and understand what the plot is giving. After googling a bit, I found people referring to
axes_labels(['x','y','z'])
But I when trying the following, I get an attribute error
a.axes_labels(['PCA1 (%0.3f)' %pca_info.fracs[0],
'PCA2 (%0.3f)' %pca_info.fracs[1],
'PCA3 (%0.3f)' %pca_info.fracs[2]])
How does one generally add labels to a 3d plot, specifically to point3d()? Or has my googling failed me, and the answer is so obvious that I completely missed it.
PJMon, 03 Oct 2011 01:13:38 -0500http://ask.sagemath.org/question/8356/