PatrickT

Dr. Patrick T

2108 Reputation

18 Badges

16 years, 303 days

MaplePrimes Activity


These are replies submitted by PatrickT

using the following commands I was able to save the data in a text file:

fd := fopen("myoutput.txt", WRITE):
fprintf( fd, %a, plottools:-getdata(myPlot) ):
fclose(fd):

The next question is: how do I handle this data? (I have a fully running Mayavi, for instance)

myoutput.txt

Any hints would be appreciated, thanks.

using the following commands I was able to save the data in a text file:

fd := fopen("myoutput.txt", WRITE):
fprintf( fd, %a, plottools:-getdata(myPlot) ):
fclose(fd):

The next question is: how do I handle this data? (I have a fully running Mayavi, for instance)

myoutput.txt

Any hints would be appreciated, thanks.

@Christopher2222 

I second Christopher's suggestions!

thanks Edgar, I've followed up on the link, this seems to be particularly good for animations and exporting to html, it seems to have figure exporting capabilities beyond the default too, so this may well be worth exploring further, thanks.

thanks Edgar, I've followed up on the link, this seems to be particularly good for animations and exporting to html, it seems to have figure exporting capabilities beyond the default too, so this may well be worth exploring further, thanks.

getdata-plot3d-maple.mw

This worksheet contains the calculations that yield the plot uploaded earlier. It also contains another plot that I'm interested in exporting as well. It's weird enough to be inserted here:

getdata-plot3d-maple.mw

This worksheet contains the calculations that yield the plot uploaded earlier. It also contains another plot that I'm interested in exporting as well. It's weird enough to be inserted here:

@Alec Mihailovs 

Thanks Alec for this example. I am using python for some other work and am reasonably familiar with numpy, scipy, etc. Once I have the data in a format I understand, I should be able to use it. And it looks like mayavi is very similar to matlab, which I know reasonably well, at least well enough to graph 3D data. But having said that I will need some guidance to get me started. So I'm very grateful that you're offering to help.

Your example is clear enough, thanks.

I have several plots that come in different data structures. For instance, applying getdata to the 3D plot I uploaded earlier gives:

URQCenterManifoldPlotData := plottools:-getdata(URQCenterManifoldPlot);
                              [          
                              [          
 URQCenterManifoldPlotData := ["curve", [
                              [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0203365506699999984 .. 0.0336028431700000006,

   0.0265129972300000016 .. 0.0274263967199999993],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0242699697899999983 .. 0.0302754847199999990,

   0.0266452148000000008 .. 0.0279002397600000008],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0257857350699999996 .. 0.0293657800500000017,

   0.0267053692200000006 .. 0.0284461459500000014],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0266970975100000002 .. 0.0290604782299999989,

   0.0266485760299999992 .. 0.0291089997399999988],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0273667073099999984 .. 0.0289969290400000010,

   0.0263891398300000017 .. 0.0299744965600000010],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0279154478900000002 .. 0.0290542490699999996,

   0.0257466776800000000 .. 0.0312230193300000007],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0283951264400000015 .. 0.0291806311299999989,

   0.0242869298200000007 .. 0.0332888278199999985],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0288316465399999986 .. 0.0293501716300000014,

   0.0207353118100000006 .. 0.0374465064900000033],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0292393991100000014 .. 0.0295484796699999990,

   0.00989618426899999994 .. 0.0488916947999999962],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0296270186899999998 .. 0.0297669207000000014,

   -0.0506712826899999998 .. 0.110065223300000001],

   [ 500 x 3 Matrix       ]]                        
   [ Data Type: float[8]  ]]                        
   [ Storage: rectangular ]], ["points", [0. .. 0.,
   [ Order: Fortran_order ]]                        

   0.0269696969699999984 .. 0.0269696969699999984,

   0.0269696969699999984 .. 0.0269696969699999984],

   [0.  0.0269696969700000  0.0269696969700000]], ["points", [

   0. .. 0., 0.0272727272700000016 .. 0.0272727272700000016,

   0.0272727272700000016 .. 0.0272727272700000016],

   [0.  0.0272727272700000  0.0272727272700000]], ["points", [

   0. .. 0., 0.0275757575799999988 .. 0.0275757575799999988,

   0.0275757575799999988 .. 0.0275757575799999988],

   [0.  0.0275757575800000  0.0275757575800000]], ["points", [

   0. .. 0., 0.0278787878799999986 .. 0.0278787878799999986,

   0.0278787878799999986 .. 0.0278787878799999986],

   [0.  0.0278787878800000  0.0278787878800000]], ["points", [

   0. .. 0., 0.0281818181799999984 .. 0.0281818181799999984,

   0.0281818181799999984 .. 0.0281818181799999984],

   [0.  0.0281818181800000  0.0281818181800000]], ["points", [

   0. .. 0., 0.0284848484800000018 .. 0.0284848484800000018,

   0.0284848484800000018 .. 0.0284848484800000018],

   [0.  0.0284848484800000  0.0284848484800000]], ["points", [

   0. .. 0., 0.0287878787899999988 .. 0.0287878787899999988,

   0.0287878787899999988 .. 0.0287878787899999988],

   [0.  0.0287878787900000  0.0287878787900000]], ["points", [

   0. .. 0., 0.0290909090899999987 .. 0.0290909090899999987,

   0.0290909090899999987 .. 0.0290909090899999987],

   [0.  0.0290909090900000  0.0290909090900000]], ["points", [

   0. .. 0., 0.0293939393899999985 .. 0.0293939393899999985,

   0.0293939393899999985 .. 0.0293939393899999985],

   [0.  0.0293939393900000  0.0293939393900000]], ["points", [

   0. .. 0., 0.0296969696999999992 .. 0.0296969696999999992,

   0.0296969696999999992 .. 0.0296969696999999992],

   [0.  0.0296969697000000  0.0296969697000000]]

 

So it appears I have stuff that comes as "curve", stuff that comes as a Matrix, and stuff that comes as "points". And it's all jumbled in together. Do you have any suggestions on how to handle this?

Because the data structure is a list of different things, I'm not sure how to go about saving the data, as you did in your example.This happens:

fprintf("name.txt","%f",URQCenterManifoldPlotData):
Error, (in fprintf) number expected for floating point format

I will upload the worksheet with the calculations that yield the plot structure in question (will do so on a follow-up comment, so as not to risk spoiling this message).

Thanks again for your help Alec, I appreciate any suggestions you may have on how to deal with the more complicated data structure.

@Alec Mihailovs 

Thanks Alec for this example. I am using python for some other work and am reasonably familiar with numpy, scipy, etc. Once I have the data in a format I understand, I should be able to use it. And it looks like mayavi is very similar to matlab, which I know reasonably well, at least well enough to graph 3D data. But having said that I will need some guidance to get me started. So I'm very grateful that you're offering to help.

Your example is clear enough, thanks.

I have several plots that come in different data structures. For instance, applying getdata to the 3D plot I uploaded earlier gives:

URQCenterManifoldPlotData := plottools:-getdata(URQCenterManifoldPlot);
                              [          
                              [          
 URQCenterManifoldPlotData := ["curve", [
                              [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0203365506699999984 .. 0.0336028431700000006,

   0.0265129972300000016 .. 0.0274263967199999993],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0242699697899999983 .. 0.0302754847199999990,

   0.0266452148000000008 .. 0.0279002397600000008],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0257857350699999996 .. 0.0293657800500000017,

   0.0267053692200000006 .. 0.0284461459500000014],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0266970975100000002 .. 0.0290604782299999989,

   0.0266485760299999992 .. 0.0291089997399999988],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0273667073099999984 .. 0.0289969290400000010,

   0.0263891398300000017 .. 0.0299744965600000010],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0279154478900000002 .. 0.0290542490699999996,

   0.0257466776800000000 .. 0.0312230193300000007],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0283951264400000015 .. 0.0291806311299999989,

   0.0242869298200000007 .. 0.0332888278199999985],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0288316465399999986 .. 0.0293501716300000014,

   0.0207353118100000006 .. 0.0374465064900000033],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0292393991100000014 .. 0.0295484796699999990,

   0.00989618426899999994 .. 0.0488916947999999962],

   [ 500 x 3 Matrix       ]]  [          
   [ Data Type: float[8]  ]]  [          
   [ Storage: rectangular ]], ["curve", [
   [ Order: Fortran_order ]]  [          

   -0.00100000000000000002 .. 0.00099999998550000008,

   0.0296270186899999998 .. 0.0297669207000000014,

   -0.0506712826899999998 .. 0.110065223300000001],

   [ 500 x 3 Matrix       ]]                        
   [ Data Type: float[8]  ]]                        
   [ Storage: rectangular ]], ["points", [0. .. 0.,
   [ Order: Fortran_order ]]                        

   0.0269696969699999984 .. 0.0269696969699999984,

   0.0269696969699999984 .. 0.0269696969699999984],

   [0.  0.0269696969700000  0.0269696969700000]], ["points", [

   0. .. 0., 0.0272727272700000016 .. 0.0272727272700000016,

   0.0272727272700000016 .. 0.0272727272700000016],

   [0.  0.0272727272700000  0.0272727272700000]], ["points", [

   0. .. 0., 0.0275757575799999988 .. 0.0275757575799999988,

   0.0275757575799999988 .. 0.0275757575799999988],

   [0.  0.0275757575800000  0.0275757575800000]], ["points", [

   0. .. 0., 0.0278787878799999986 .. 0.0278787878799999986,

   0.0278787878799999986 .. 0.0278787878799999986],

   [0.  0.0278787878800000  0.0278787878800000]], ["points", [

   0. .. 0., 0.0281818181799999984 .. 0.0281818181799999984,

   0.0281818181799999984 .. 0.0281818181799999984],

   [0.  0.0281818181800000  0.0281818181800000]], ["points", [

   0. .. 0., 0.0284848484800000018 .. 0.0284848484800000018,

   0.0284848484800000018 .. 0.0284848484800000018],

   [0.  0.0284848484800000  0.0284848484800000]], ["points", [

   0. .. 0., 0.0287878787899999988 .. 0.0287878787899999988,

   0.0287878787899999988 .. 0.0287878787899999988],

   [0.  0.0287878787900000  0.0287878787900000]], ["points", [

   0. .. 0., 0.0290909090899999987 .. 0.0290909090899999987,

   0.0290909090899999987 .. 0.0290909090899999987],

   [0.  0.0290909090900000  0.0290909090900000]], ["points", [

   0. .. 0., 0.0293939393899999985 .. 0.0293939393899999985,

   0.0293939393899999985 .. 0.0293939393899999985],

   [0.  0.0293939393900000  0.0293939393900000]], ["points", [

   0. .. 0., 0.0296969696999999992 .. 0.0296969696999999992,

   0.0296969696999999992 .. 0.0296969696999999992],

   [0.  0.0296969697000000  0.0296969697000000]]

 

So it appears I have stuff that comes as "curve", stuff that comes as a Matrix, and stuff that comes as "points". And it's all jumbled in together. Do you have any suggestions on how to handle this?

Because the data structure is a list of different things, I'm not sure how to go about saving the data, as you did in your example.This happens:

fprintf("name.txt","%f",URQCenterManifoldPlotData):
Error, (in fprintf) number expected for floating point format

I will upload the worksheet with the calculations that yield the plot structure in question (will do so on a follow-up comment, so as not to risk spoiling this message).

Thanks again for your help Alec, I appreciate any suggestions you may have on how to deal with the more complicated data structure.

@ pagan

getting back to you about bmp versus gif: it must depend on the specificities of the plot, I guess, because I'm not noticing big differences in this instance; namely (without enlarging manually, simply by using plotsetup and with the same options) : gif has more elegant axes and labels than bmp, both thinner and clearer, but being thin it has problems in places, in particular the label "0.001" which is almost completely erased. By contrast bmp has darker but coarser axes, and slightly larger labels, it prints the "0.001" label better than gif, but unfortunately the colored lines of the plot, while thicker, are less well defined, blurred in places, and overall in my judgement less pretty. But let's face it, neither gif nor bmp produces a satisfactory graph.

@ pagan

getting back to you about bmp versus gif: it must depend on the specificities of the plot, I guess, because I'm not noticing big differences in this instance; namely (without enlarging manually, simply by using plotsetup and with the same options) : gif has more elegant axes and labels than bmp, both thinner and clearer, but being thin it has problems in places, in particular the label "0.001" which is almost completely erased. By contrast bmp has darker but coarser axes, and slightly larger labels, it prints the "0.001" label better than gif, but unfortunately the colored lines of the plot, while thicker, are less well defined, blurred in places, and overall in my judgement less pretty. But let's face it, neither gif nor bmp produces a satisfactory graph.

This post and further elaborations of it should be made a "sticky" of mapleprimes, easy for newbies to reach.

I would much prefer being able to export the graph automatically via plotsetup, but at this time the output is prettier by right-clicking... for instance, the label 0.0010 along the u axis, that's very ugly, and the definition  of the axis is quite poor as well.

P.S.can't experiment with your suggestions at this time, but will do so in 48 hours or so, thanks.

I would much prefer being able to export the graph automatically via plotsetup, but at this time the output is prettier by right-clicking... for instance, the label 0.0010 along the u axis, that's very ugly, and the definition  of the axis is quite poor as well.

P.S.can't experiment with your suggestions at this time, but will do so in 48 hours or so, thanks.

Alec, do you mean to redraw the graph from scratch? That would be quite inconvenient because it is produced at the tail-end of a long series of symbolic calculations. But exporting the data created by Maple using, say, getdata and manipulating that data in Mayavi would be acceptable to me. Would that be easy to do? Would you mind showing a minimal example?

thanks in advance,

P.S. Off to a long-distance flight, may not be able to revisit the site for 48 hours or so.

P.S.2 it would be great if I could easily check it from my phone using some mapleprimes app! but currently using mapleprimes via an internet browser from the phone is very, very impractical.

First 43 44 45 46 47 48 49 Last Page 45 of 93