Re: Re: question on Plot and Show plus Axis Labels
- To: mathgroup at smc.vnet.net
- Subject: [mg72627] Re: [mg72579] Re: question on Plot and Show plus Axis Labels
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 12 Jan 2007 06:33:57 -0500 (EST)
- Reply-to: hanlonr at cox.net
Use ListPlot for discrete data.
Needs["Graphics`"];
n = 5;
x = Table[i, {i, -n, n}];
y1[x_] := x;
y2[x_] := x^2;
y3[x_] := x^3;
p1 = {#,y1[#]}&/@x;
p2 = {#,y2[#]}&/@x;
p3 = {#,y3[#]}&/@x;
Plot[{y1[x], y2[x], y3[x]}, {x, -n, n},PlotRange->All];
DisplayTogether[
ListPlot[#,PlotJoined->True,PlotRange->All]&/@
{p1,p2,p3}];
Bob Hanlon
---- Gopinath Venkatesan <gopinathv at ou.edu> wrote:
> My sincere thanks to David, Bill, Pratik and Bob.
>
> I got it working now. I used MultipleListPlot for the problem, with Frames -> True. I think if I dont use Frames, rotating the y-axis label is difficult. Here is a sample of my code.
>
> MultipleListPlot[{y0, y, y1, y2}, PlotJoined -> {True, True, True, True}, Frame -> True,
> FrameLabel -> {FontForm["XaxisLabelhere", {"Courier-Bold", 14}], FontForm["YaxisLabelhere",
> {"Courier-Bold", 14}]}, PlotStyle -> {{Thickness[0.005], GrayLevel[0.75]}, {Thickness[0.005], GrayLevel[0]},
> {GrayLevel[0.75], Dashing[{0.009}]}, {GrayLevel[0], Dashing[{0.009}]}},
> PlotLegend -> {"Analytical 1", "Analytical 2", "Test 1", "Test 2"}, ImageSize -> 500, PlotRange -> All,
> RotateLabel -> True, SymbolShape -> {None, None, None, None}, LegendPosition -> {-0.7, -0.45}, LegendSize -> {0.7, 0.3}]
>
> Bob,
> I see that Plot is working if we directly substitute the functions inside, as well as to some functions with a rule, and in some cases, we need Evaluate[] for the same. But somehow, when I used Plot[] for my dataset, its giving me error saying 'not a machine-size real number at x=1.0000+'. The command MultipleListPlot works great.
>
> For example, see the below code.
>
> n = 5;
> x = Table[i, {i, -n, n}];
> y1[x_] := x;
> y2[x_] := x^2;
> y3[x_] := x^3;
> p1 = Table[y1[x[[i]]], {i, 1, 2*n + 1}];
> p2 = Table[y2[x[[i]]], {i, 1, 2*n + 1}];
> p3 = Table[y3[x[[i]]], {i, 1, 2*n + 1}];
> Plot[{y1[x], y2[x], y3[x]}, {x, -n, n}];
> Plot[p1, {x, -n, n}];
>
> Plot works fine when we directly substitute the functions, but not when we place the table of data already generated. Placing Evaluate[] or //N in Table doesnt help too.
>
> Gopinath Venkatesan
> Graduate Student
> University of Oklahoma
>