Mathematica: Plot a vector NOT against the component number

Click For Summary
SUMMARY

The discussion focuses on using Mathematica to plot a list object against a custom scale derived from a function of the component number. The user successfully implemented a solution by defining a function, myf[n_] = n^2, to create a new scale and then transposing the results for plotting. The final code snippet provided, ListPlot[myresult, PlotJoined -> True, AxesOrigin -> 0], effectively visualizes the data as intended. This method allows for greater flexibility in plotting beyond the default component numbering.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of list manipulation in Mathematica
  • Basic knowledge of plotting functions in Mathematica
  • Concept of function mapping in programming
NEXT STEPS
  • Explore advanced plotting techniques in Mathematica
  • Learn about custom tick marks and scales in ListPlot
  • Investigate function mapping and transformation in Mathematica
  • Study data visualization best practices for effective representation
USEFUL FOR

Mathematica users, data analysts, and anyone interested in advanced data visualization techniques using custom scales in plots.

faradayslaw
Messages
48
Reaction score
0
Hi,

I wish to listplot a list object against a scale that is NOT the component number of the vector, but is actually a well defined function of the component number, and I am lost how to do this?

changing "Ticks" didn't help, or I did it wrong, so I am wondering if anyone knows how to do this.

Thanks
 
Physics news on Phys.org
Construct your substitute for the "component number" and transpose to put it in position

Example:

mylist = {1, 2, 7, 4};
myf[n_] = n^2;
myscale = Map[myf, Range[Length[mylist]]];
myresult = Transpose[{myscale, mylist}];
ListPlot[myresult, PlotJoined -> True, AxesOrigin -> 0]
 
worked well, thanks
 

Similar threads

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