Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9432 > unrolled thread

ListPlot question

Started byJK <junkyung.auh@gmail.com>
First post2012-04-05 09:53 +0000
Last post2012-04-06 10:02 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  ListPlot question JK <junkyung.auh@gmail.com> - 2012-04-05 09:53 +0000
    Re: ListPlot question Murta <rodrigomurtax@gmail.com> - 2012-04-06 09:52 +0000
    Re: ListPlot question Yi Wang <tririverwangyi@gmail.com> - 2012-04-06 09:59 +0000
    Re: ListPlot question Helen Read <readhpr@gmail.com> - 2012-04-06 10:02 +0000

#9432 — ListPlot question

FromJK <junkyung.auh@gmail.com>
Date2012-04-05 09:53 +0000
SubjectListPlot question
Message-ID<jljq20$ct8$1@smc.vnet.net>
I have a user defined function f[x]. I want to plot it discretely
using ListPlot.
Specifically, I want to do:

ListPlot[f[x],{x,0,0.5,0.1}]

So I want plot 5 point from the function with 5 sequence of arguments.
However, the figure has an axis value of 0 to 5 instead of 0 to 0.5.
Is there anyway to fix this?

Thanks
JK

[toc] | [next] | [standalone]


#9464

FromMurta <rodrigomurtax@gmail.com>
Date2012-04-06 09:52 +0000
Message-ID<jlmecs$m5d$1@smc.vnet.net>
In reply to#9432
On Apr 5, 6:53 am, JK <junkyung....@gmail.com> wrote:
> I have a user defined function f[x]. I want to plot it discretely
> using ListPlot.
> Specifically, I want to do:
>
> ListPlot[f[x],{x,0,0.5,0.1}]
>
> So I want plot 5 point from the function with 5 sequence of arguments.
> However, the figure has an axis value of 0 to 5 instead of 0 to 0.5.
> Is there anyway to fix this?
>
> Thanks
> JK

Hi JK
Maybe this works for what you need.

ListPlot[Table[f[x],{x,0,0.5,0.1}],PlotRange -> {{0, 5}, All}]

best regards
Murta

[toc] | [prev] | [next] | [standalone]


#9471

FromYi Wang <tririverwangyi@gmail.com>
Date2012-04-06 09:59 +0000
Message-ID<jlmepc$mea$1@smc.vnet.net>
In reply to#9432
Hi, JK

You can first make a list and then plot it. As you can find in help, ListPlot has 3 forms of usage. The second solves your problem:

ListPlot[ { {x1, y1}, {x2, y2},... } ]

To be explicit, you can try

ListPlot[Table[{x, Sin[x]}, {x, 0, 0.5, 0.1}]]

Best,
Yi

On Thursday, April 5, 2012 5:53:04 AM UTC-4, JK wrote:
> I have a user defined function f[x]. I want to plot it discretely
> using ListPlot.
> Specifically, I want to do:
> 
> ListPlot[f[x],{x,0,0.5,0.1}]
> 
> So I want plot 5 point from the function with 5 sequence of arguments.
> However, the figure has an axis value of 0 to 5 instead of 0 to 0.5.
> Is there anyway to fix this?
> 
> Thanks
> JK

[toc] | [prev] | [next] | [standalone]


#9475

FromHelen Read <readhpr@gmail.com>
Date2012-04-06 10:02 +0000
Message-ID<jlmev4$mgj$1@smc.vnet.net>
In reply to#9432
On 4/5/2012 5:53 AM, JK wrote:
> I have a user defined function f[x]. I want to plot it discretely
> using ListPlot.
> Specifically, I want to do:
>
> ListPlot[f[x],{x,0,0.5,0.1}]
>
> So I want plot 5 point from the function with 5 sequence of arguments.
> However, the figure has an axis value of 0 to 5 instead of 0 to 0.5.
> Is there anyway to fix this?

I don't see how you are getting ListPlot to work at all, if that's 
really what you did. ListPlot expects a list of y-values or a list of 
points. You could make a table of points and then use ListPlot to plot 
the table. But I think what you really want here is DiscretePlot.


f[x_] := x^2

DiscretePlot[f[x], {x, 0, 0.5, 0.1}, Filling -> False,
  PlotStyle -> PointSize[Medium]]


-- 
Helen Read
University of Vermont

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web