How to Plot Large Data Sets in Mathematica?

Click For Summary

Discussion Overview

The discussion revolves around how to plot large data sets in Mathematica, specifically focusing on a scenario where a user has a text file containing approximately 50,000 data points generated from a C++ program. The conversation includes attempts to troubleshoot plotting issues and requests for assistance with file formatting and Mathematica commands.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant inquires about plotting data points from a text file in Mathematica.
  • Another participant suggests modifying the C++ program to format the output as a Mathematica-compatible list, providing an example of the required format.
  • There is a suggestion to learn about Mathematica's file reading methods if the data cannot be formatted as proposed.
  • A participant requests the problematic data file and a sample Mathematica notebook to diagnose the issue further, recommending testing with a smaller data set first.
  • One participant shifts the topic by asking how to add a new topic in the forum.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best method to plot the data, as troubleshooting steps and suggestions vary. The discussion remains unresolved regarding the specific plotting issue faced by the user.

Contextual Notes

Limitations include potential issues with file formatting and the need for specific Mathematica commands that may not be clear to all participants. The discussion does not resolve the underlying problems with the plotting attempts.

Who May Find This Useful

Users of Mathematica looking for assistance with plotting large data sets, particularly those transitioning from C++ or dealing with data file formatting issues.

yashar
Messages
31
Reaction score
0
hi
i compile a c++ program and after compiling it gives me a txt file which contains about 50000 points.
how i can plot these points in mathematica?
thanks
 
Physics news on Phys.org
Several ways.

1: IF your c++ program can be slightly modified to give you a file exactly like
{
1,
2,
4,
3
}
and you can drop that file into your Mathematica folder and call it xox.txt then

ListPlot[<<"xox.txt"]

is all you need.

If you can't include the surrounding { and } and end each line except the next to last ending with a comma then your file won't contain a single complete Mathematica expression and you can start learning about how Mathematica does low level file reads and how to store individual lines into a list and then ListPlot the resulting list.

If you can't drop the file into your Mathematica folder then you can start learning about the nonstandard method that Mathematica uses to give a path to your file and use that.
 
hi
i upload the data.txt file .
how to plot it?
i tried ListPlot but it did not work
thanks
 
Last edited:
Attach your data.txt file and a very tiny Mathematica notebook that you are using to try to read and plot that *without any changes* to your next post here. I will look at those and try to see if there is a problem with them or whether the problem is somewhere else.

And temporarily modify your C++ program so you don't send me 50000 points, create 50 points, verify that still doesn't work and then post the 50 point file and notebook.

And if "but it did not work" meant you got a warning message displayed when you tried to plot then include the exact message it displayed in your post.
 
Last edited:
Could everybody tells me how can i add a new topic ?
Thanks a lot
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K