How to Sort and Manipulate Data for List Plotting in Mathematica?

In summary, the conversation is about importing a .dat file into Mathematica and creating a list plot. The main questions are how to sort words out of the data and how to switch the axis on the graph. The code being used involves importing the data, dropping the header, and using ListPlot. The solution suggested is to use the Reverse function and provide an example in more detail.
  • #1
TwoSeat
4
0
I am importing data as a .dat file into Mathematica and making a list plot. I need to know: a)How to sort the words out of my data? I used to use AllNumeric but that went away with version 6
b)How to switch the axis on my graph? My data is coming in as a pair sequence {1#`,2#`} but I need it to be {2#`,1#`} Or I need to know how to rotate my plotting sequence so it will flip.


This is the code I am using

data=Import["Test2.dat","Data"];
b=Drop[data,5]; %This just removes the header from my data file
ListPlot
 
Physics news on Phys.org
  • #2
Try this:
Code:
data=Import["Test2.dat","Data"];
b=Reverse[Drop[data,5],2];
ListPlot[b]
 
  • #3
Thanks!
 
  • #4
Does you know how to sort words out of data? I have lists of data combined into one sheet and need to remove the column headings out of the data before it is plotted.
 
  • #5
Can you post an example in more detail?
 
  • #6
It has two columns of that are combined lists of test data. Every so often there will be titles and headings inserted into the two columns and I need to delete these in order to use the ListPlot command.

Unfortunately I cannot upload it in a large section so there is just the start of it attached.

Thank you for all of your help
 

Attachments

  • BitofData.txt
    641 bytes · Views: 402

What is the purpose of plotting data in Mathematica?

The purpose of plotting data in Mathematica is to visually represent and analyze data in a graphical format. This allows for easier interpretation and understanding of the data, and can aid in identifying patterns, trends, and relationships.

What types of plots are available in Mathematica?

Mathematica offers a wide variety of plot types, including line plots, scatter plots, bar charts, histograms, pie charts, and more. It also allows for customization and combination of different plot types to create more complex visualizations.

How do I import data into Mathematica for plotting?

Data can be imported into Mathematica through various methods, such as copy and paste, importing from a file, or using built-in functions to access online data sources. The imported data can then be manipulated and plotted using Mathematica's powerful data analysis tools.

Can I add labels, titles, and other annotations to my plots in Mathematica?

Yes, Mathematica allows for customization of plots through the use of various options and functions. This includes adding labels, titles, legends, and other annotations to make the plots more informative and visually appealing.

Can I export my plots from Mathematica for use in other programs or documents?

Yes, Mathematica offers a variety of export options, including image formats (PNG, JPEG, etc.), vector graphics formats (PDF, EPS, etc.), and even interactive formats (HTML, GIF, etc.). This allows for easy sharing and integration of plots into presentations, reports, and other documents.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
397
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
420
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
286
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Back
Top