ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 07 Apr 2019 14:00:20 -0500load data file to draw surfacehttp://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/ I have a matrix consisting of 512 rows and 512 columns. I have written this matrix down into a text file. Each cell of the matrix contains a positive value. I want to plot these values in 3 dimensional system to form a surface by uploading the text file. How to do it in sage ?
Thank youThu, 23 Oct 2014 03:56:20 -0500http://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/Answer by vdelecroix for <p>I have a matrix consisting of 512 rows and 512 columns. I have written this matrix down into a text file. Each cell of the matrix contains a positive value. I want to plot these values in 3 dimensional system to form a surface by uploading the text file. How to do it in sage ? </p>
<p>Thank you</p>
http://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/?answer=24657#post-id-24657 Hello,
First you have to load the matrix into sage. It really depends on how did you save the values. To open a file you use the function **open** from Python.
Secondly, given a matrix, I am not sure there is a ready made solution inside Sage. But you might use `point3d`. I would think that the best solution is to use directly matplotlib (which is what Sage uses in background). You can have a look at [these matplotlib examples](http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#surface-plots).
VincentMon, 27 Oct 2014 12:47:55 -0500http://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/?answer=24657#post-id-24657Comment by FrédéricC for <p>Hello,</p>
<p>First you have to load the matrix into sage. It really depends on how did you save the values. To open a file you use the function <strong>open</strong> from Python.</p>
<p>Secondly, given a matrix, I am not sure there is a ready made solution inside Sage. But you might use <code>point3d</code>. I would think that the best solution is to use directly matplotlib (which is what Sage uses in background). You can have a look at <a href="http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#surface-plots">these matplotlib examples</a>.</p>
<p>Vincent</p>
http://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/?comment=46042#post-id-46042There is something ready to use
sage: m = matrix(QQ,10,10,lambda i,j : i**2+j**2)
sage: list_plot3d(m)Sun, 07 Apr 2019 14:00:20 -0500http://ask.sagemath.org/question/24589/load-data-file-to-draw-surface/?comment=46042#post-id-46042