I am working with Maple (17). I am quite new at it and I need to learn or get to know how extract the raw data or data points from a contourplot (2d plot) to a text file or whatever, but just get the data and later plot in other software.
Asked
Active
Viewed 398 times
-1
-
4What have you tried to achieve your wanted results? What has your research concerning your problem shown? Can you provide code of your tries? [How do I ask a good question](https://stackoverflow.com/help/how-to-ask), [How much research effort is expected](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) and [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) might be helpful to improve your question. – Geshode Jan 25 '18 at 11:08
-
1Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Jan 25 '18 at 12:38
-
Are you using Maple 17 (released in the year 2013) or Maple 2017 (released in the year 2017)? In the year 2015 the company Maplesoft started naming their product versions by the year in which they were released. – acer Jan 26 '18 at 04:47
1 Answers
0
Maple's 2D plotting commands construct function calls in Maple's own language, which can be examined using stock commands (eg. nops
, op
, lprint
, select
, etc).
Of course the layout and nature of the contents of these PLOT
function calls (which server as data structure) vary according to which particular plotting command produces them.
Here is some basic poking at the contents of the PLOT
function call returned by the plots:-contourplot
command.
restart;
P := plots:-contourplot( sin(x)*y^2,
x=-Pi..Pi, y=-1..1,
contours=[-1/2,-1/7,1/7,1/2],
grid=[39,39] ):
# The GUI prints the PLOT structure by rendering it graphically.
P;
# Data for 2D curves are stored within substructures that are
# function calls to the name `CURVES`.
Pdata := select( type, [op(P)], specfunc(anything,CURVES) ):
# There are four CURVES within this particular structure
# assigned to P, corresponding to the 4 named contour values.
nops(Pdata);
4
# Select only the numeric data, in a list.
C1 := select( type, [op(Pdata[1])], list(list(numeric)) ):
# There happen to be 78 entries of data.
nops( C1 );
78
# Print the first five entries in list C1.
# Each one is a list of two lists. In each such pair
# the two lists each contain two floats, representing
# x and y coordinates of a point.
# Each list of two points represents a line segment.
# This first CURVE is stored as 78 individual line segments
# (but here is the end-point data for 5 of those).
map(print, C1[1..5]):
[[0.524804672715281, -1.], [0.560425257062589, -0.967862584000641]]
[[0.593087222168692, -0.947368421052632], [0.560425257062589, -0.967862584000641]]
[[0.593087222168692, -0.947368421052632], [0.611600658135984, -0.931520641144355]]
[[0.661387927071535, -0.902063357909845], [0.611600658135984, -0.931520641144355]]
[[0.661387927071535, 0.902063357909845], [0.593087222168693, 0.947368421052631]]
You could look at the commands Export
, writedata
, fprintf
, or ExportMatrix
for choices about exporting such data to files. But of course first you'd need to decide on your target format.

acer
- 6,671
- 15
- 15