MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plotting a step function with the origin indicated

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21278] Re: [mg21248] Plotting a step function with the origin indicated
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 21 Dec 1999 03:46:58 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Mathematica only plots over the range of the function, which in the second case does
not include the origin you specified. This can be remedied by specifying the plot
range explicitly with the PlotRange option:

Plot[q[y], {y, -1, 1}, PlotStyle -> RGBColor[1, 0, 0],
AxesOrigin -> {0, 0}, PlotRange -> {-1, 1}];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

>Here are two step functions:
>
>p[x_] := If[.3 < x < 2, -3, .2]
>q[y_] := If[0 < y < 1, 1, .2]
>
>If I try to plot these function with a {0,0} origin specified, I get (what
>seem to me) inconsistent results:
>
>Plot[p[x], {x, -1, 1}, PlotStyle -> RGBColor[1, 0, 0],
>AxesOrigin -> {0, 0}]
>
>Plot[q[y], {y, -1, 1}, PlotStyle -> RGBColor[1, 0, 0],
>AxesOrigin -> {0, 0}]
>
>The first behaves as I thought it should. The axes cross at {0,0}. The
>second does not-- the y-axis is not completed.  This also occurs if the
>PlotStyle->RGBColor is not included in the Plot call. Is there a way to get
>the axes to cross in the second case?
>




  • Prev by Date: Re: Plotting a step function with the origin indicated
  • Next by Date: Re: Dropping terms in a complex expression
  • Previous by thread: Re: Plotting a step function with the origin indicated
  • Next by thread: Q: Conjugate