Re: Plotting a large dataset
- To: mathgroup at smc.vnet.net
- Subject: [mg94372] Re: Plotting a large dataset
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 11 Dec 2008 03:46:33 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <ghj057$fid$1@smc.vnet.net> <ghlmfk$k9e$1@smc.vnet.net> <gho37a$4q$1@smc.vnet.net>
Nikolaus Rath wrote:
> Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> writes:
>> Nikolaus Rath wrote:
>>
>>> I have trouble plotting a dataset of 2048000 reals. I tried the
>>> following code (as recently suggested on the list):
>>>
>>> xdata1 = ReadList[prefix <> "1.dat", Real, RecordLists -> False];
>>> xdata1 = Developer`ToPackedArray[xdata1];
>>> Dimensions[xdata1]
>>> (* yields {2048000} *)
>>> ListPlot[xdata1, PerformanceGoal -> "Speed"]
>>>
>>>
>>> but I'm simply running out of main memory (2 GB available). Since I
>>> can plot the same data within seconds using IDL, I guess Mathematica
>>> should be able to do the same. But how?
>> Hi Nikolaus,
>>
>> Assuming I have understood correctly what the problem is, using the
>> option *MaxPlotPoints*, fed with some appropriate value depending on
>> your actual dataset, should allow ListPlot[] to display a meaningful
>> plot exhibiting the main characteristics or trends of your data while
>> being memory conservative.
>
> This works *much* better, thank you! Were did you learn about this
> option? The ListPlot help in Mathematica 6.0.2 doesn't mention it.
Although I could not say for sure from where I learned about the
MaxPlotPoints option for the first time (possibly this newsgroup or the
Options[ListPlot] command), the option is listed when one evaluate the
following expression (as a rule of thumb, I believe it is always a good
idea to explore the options of a function thanks to the directive
Options[xx], then you can get additional information with "?" and/or the
online documentation center),
In[49]:= Options[ListPlot]
Out[49]= {AlignmentPoint -> Center, AspectRatio -> 1/GoldenRatio,
Axes -> True, AxesLabel -> None, AxesOrigin -> Automatic,
AxesStyle -> {}, Background -> None, BaselinePosition -> Automatic,
BaseStyle -> {}, ClippingStyle -> None, ColorFunction -> Automatic,
ColorFunctionScaling -> True, ColorOutput -> Automatic,
ContentSelectable -> Automatic, DataRange -> Automatic,
DisplayFunction :> $DisplayFunction, Epilog -> {}, Filling -> None,
FillingStyle -> Automatic, FormatType :> TraditionalForm,
Frame -> False, FrameLabel -> None, FrameStyle -> {},
FrameTicks -> Automatic, FrameTicksStyle -> {}, GridLines -> None,
GridLinesStyle -> {}, ImageMargins -> 0., ImagePadding -> All,
ImageSize -> Automatic, InterpolationOrder -> None, Joined -> False,
LabelStyle -> {}, MaxPlotPoints -> \[Infinity], Mesh -> None,
MeshFunctions -> {#1 &}, MeshShading -> None, MeshStyle -> Automatic,
Method -> Automatic, PerformanceGoal :> $PerformanceGoal,
PlotLabel -> None, PlotMarkers -> None, PlotRange -> Automatic,
PlotRangeClipping -> True, PlotRangePadding -> Automatic,
PlotRegion -> Automatic, PlotStyle -> Automatic,
PreserveImageOptions -> Automatic, Prolog -> {}, RotateLabel -> True,
Ticks -> Automatic, TicksStyle -> {}}
In[50]:= ?MaxPlotPoints
MaxPlotPoints is an option for plotting functions like ArrayPlot and \
ListPlot3D that specifies the maximum number of points that will \
explicitly be included in the output. >>
<snip>
Regards,
-- Jean-Marc