Mathematica: Regarding ListPlot and Manipulate

  • Context: Mathematica 
  • Thread starter Thread starter Kortirion
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around the use of ListPlot in combination with Manipulate in Mathematica, specifically focusing on visualizing functions dependent on a parameter t. Participants explore various approaches to achieve the desired graphical representation of these functions, including the challenges faced when using ListPlot for this purpose.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant expresses difficulty in visualizing a specific function alongside others using ListPlot and Manipulate, noting that while the function can be plotted alone, it does not appear in the combined plot.
  • Another participant suggests that ListPlot may be misinterpreted as plotting functions rather than data points, recommending the use of Plot instead.
  • A different participant mentions switching to NDSolve for obtaining solutions and seeks advice on visualizing these solutions spaced equally on a line using Manipulate.
  • One participant proposes an alternative structure using GraphicsRow to potentially achieve the desired visualization, although they do not fully understand the original intent.
  • Another participant shares a working solution using the Block command within Manipulate to correctly visualize the function values as intended.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to visualize the functions. Multiple competing views and methods are presented, with some participants suggesting different commands and structures to achieve similar outcomes.

Contextual Notes

Some limitations arise from the interpretation of ListPlot versus Plot, as well as the handling of function objects in Mathematica. The discussion reflects varying levels of familiarity with Mathematica's commands and their implications for plotting.

Who May Find This Useful

This discussion may be useful for Mathematica users looking to visualize multiple functions simultaneously, particularly those interested in the nuances of using ListPlot and Manipulate together.

Kortirion
Messages
8
Reaction score
0
I am having trouble with ListPlot in combination with Manipulate. I can't see why it doesn't do what I tell it to.

What I'm trying to do: I have several functions that is dependent upon one parameter t. These functions I got from solving a system with DSolve. I'd like to see their values varying with this parameter t next to each other like amplitude spikes, spaced 1 apart on an axis (not the t axis!).

What I did: I tried using the Manipulate command like this

Manipulate[ListPlot[{
0.02 t^2,
0.4 t,
Abs[Subscript[y, 5][t] /. solution[[1]]]^2,
0.4 t,
0.02 t^2},
Filling -> filling, PlotRange -> All], {t, 0, 25}, {filling, {None, Axis, Top, Bottom}}]

here on place 3 is one of the functions that I'd like to see varying with t, and the other four places is just filled with some "whatever" functions.

What I get: I get the anticipated evolution of all those "whatever" functions, although nothing for the one in the middle at place 3. This is strange to me! Since I can successfully plot the function alone in t like this

Plot[Abs[Subscript[y, 5][t] /. solution[[1]]]^2, {t, 0, 75}]

But in the above Manipulate and ListPlot I have a total blank on place 3.


Someone feeling handy today?
 
Physics news on Phys.org
This is a wild guess here.

I'm thinking you believe ListPlot means plot this list of functions.

I believe Mathematica thinks ListPlot means plot this list of data points.
http://reference.wolfram.com/mathematica/ref/ListPlot.html?q=ListPlot&lang=en
I do not believe ListPlot creates lists of points for you.

Perhaps try
Manipulate[Plot[{
0.02 t^2,...

and see what you get.
Plot[{a list of functions}
should plot that list of functions on top of each other.

OR

Temporarily throw away your Manipulate and just see what

ListPlot[{
0.02 t^2,...

does for a specific value of t. If that doesn't work then you have narrowed down your problem.
 
Hello and thanks for the reply.
I know what ListPlot does in that sense, however I thought it was worth a try since it did work to visualize an explicit functions amplitude like I wanted. Only now it failed with using something I've got as a solution. Bleh.

I've changed some stuff now to accommodate nonliterary in my system, so it's NDSolve now. From this I receive nice solutions, but I'd still like to visualize them simultaneously spaced equally on a line. These will look like dots moving up and down as I vary the parameter t on each "site". Get the picture?
I'm no pro at Mathematica, so do you know of any way to realize this? As I looked at it the Manipulate function and it looks like the best bet as I'd like to be able to vary t forth and back.
 
I'm sorry, but I don't get the picture.

Are you possibly trying to accomplish something like

Manipulate[
GraphicsRow[{
Plot[someCompletePlotDependingOnt],
Plot[someOtherCompletePlotDependingOnt],
Plot[yetAnotherCompletePlotDependingOnt],
Plot[etcCompletePlotDependingOnt]
}],
restOfMainpulateArgumentsIncludingt
]

http://reference.wolfram.com/mathematica/ref/GraphicsRow.html
 
Last edited:
Hey again. And no, that's not quite what I'd like. And ok, if you don't get my picture just run this and see

Manipulate[
ListPlot[{0.02 t^2, 0.4 t, 17 Sin[t], 0.4 t, 0.02 t^2},
PlotRange -> 30, Filling -> filling], {t, 0,
35}, {filling, {None, Axis, Bottom, Top}}]

It views the plot as one-dimensional, having those dots racing up and down. Maybe there's some better option to this than using ListPlot and the rest, but I don't know of any.. Thank you for your time trying to help, much appreciated.
 
Hello. Just reporting in that I solved this issue by using the "Block" command

Manipulate[
ListLinePlot[
Table[Block[{t = k}, Abs[Subscript[y, i][t] /. solution[[1]]]^2], {i, 50, 151}],
PlotRange -> {0, 0.7}, Filling -> Axis], {k, 0, 1100}]

With this it, as I wanted, actually took forth the value of my solution and did not treat it as an "object".
 

Similar threads

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