0
|
25280 Views
|
10 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# I wish to plot two Lists in a same single graph..

Posted 11 years ago
 I have the following simple programv1 = {}; v2 = {};For[t = 0, t < 100, t = t + 1, y = 2 t + 3; z = 4 t - 8; AppendTo[v1, {t, y}]; AppendTo[v2, {t, z}]; ]This program generates two distinct lists. Named as "v1" and "v2" having elements in the form of {t,y}, {t,z} respectively.  Now I wish to plot the Lists "v1" and "v2" on a same single graph having "t" variable on x - axis.Thanks in advance.
10 Replies
Sort By:
Posted 11 years ago
 Insteed,I have have Found a folowing small solution of it...I have attached a small proggrame here with it.. Please find in attachments...Please suggest an appropriate method of solving it...In this mathod we have two Different Verticle axis for both the Plots, this solves our ploblem.. Attachments:
Posted 11 years ago
 Oh, I see. Using two different axes is certainly one possibility. Another one is to use a Log plot:ListLogPlot[{List1, List2}]The advantage of your method is that the curves do not look "distorted". But if you get used to the logarithmic represenation it is actually easy to read and there is the advantage that one can more easily compare the values of the two curves on a sigle axis.M.
Posted 11 years ago
 Hi,Show[{ListPlot[v1], ListPlot[v2]},PlotRange->All]might do the trick.M.
Posted 11 years ago
 It's not working as per my reqiurement..Pleaz suggest some other method
Posted 11 years ago
Posted 11 years ago
 That's the same as the previsous solution!v1 = {}; v2 = {};For[t = 0, t < 100, t = t + 1, y = 2 t + 3; z = 4 t - 8; AppendTo[v1, {t, y}]; AppendTo[v2, {t, z}];]Show[{ListPlot[v1], ListPlot[v2]}, PlotRange -> All]I do not understand how that is not working as per the requirement.  Now I wish to plot the Lists "v1" and "v2" on a same single graph having "t" variable on x - axis.v1 and v2 are in the same single graph. The time is on the x-axis. This seems to do exaclty what you want. What is the requirement that it does not fulfil?
Posted 11 years ago
 Respected @Marco Thiel and  @Girish Arabale,Thanks for ur reply,This Mathod is appropriate when The range on Y- axis of both the Graphs are Compatible with each other.But In case when the range of both the Lists vary conciderably , then we persist a problem....v1 = {}; v2 = {};For[t = 0, t < 100, t = t + 1, y = 2 t^3 + 3;(*I have replaced "y = 2 t + 3" with "y = 2 t^3 + 3"*) z = 4 t - 8; AppendTo[v1, {t, y}]; AppendTo[v2, {t, z}];]Show[{ListPlot[v1], ListPlot[v2]}, PlotRange -> All]
Posted 11 years ago
 Respected @Marco Thiel and @Girish Arabale,Thanks for ur reply,This Mathod is appropriate when The range on Y- axis of both the Graphs are Compatible with each other.But In case when the range of both the Lists vary conciderably , then we persist a problem....v1 = {}; v2 = {};For[t = 0, t < 100, t = t + 1, y = 2 t^3 + 3;(*I have replaced "y = 2 t + 3" with "y = 2 t^3 + 3"*) z = 4 t - 8; AppendTo[v1, {t, y}]; AppendTo[v2, {t, z}];]Show[{ListPlot[v1], ListPlot[v2]}, PlotRange -> All]
Posted 11 years ago
 Closely related to http://community.wolfram.com/groups/-/m/t/228300
Posted 11 years ago
 I do not believe this capability exists in Mathematica 9, at least not without a great deal of custom graphics programming. However, I think it would be a very valuable enhancement, which I have in the past requested of our friends at WRI,At one time, it was common to display such data sets together by introducing different axes. For two data sets it was common to have separate axes on the left and right sides. For more than two data sets this becomes cluttered. Today, a form of stacked graph finds more favor. Below is a clip from the web:If these data were graphed using the same y-axis, the features would be less obvious. There are of course more extreme examples. Placing them on a Log graph would produce a different view, and a data set that contains negative values can never be shown on a log graph.I would dearly love to see capabilites like this added to Mathematica as built in capabilities.Best regards,David