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: [mg21287] Re: [mg21248] Plotting a step function with the origin indicated
  • From: BobHanlon at aol.com
  • Date: Tue, 21 Dec 1999 03:47:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

A work-around is to plot a line along the x-axis (i.e., is invisible).

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

Or, you can explicitly state the PlotRange

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

Bob Hanlon

In a message dated 12/20/1999 4:14:34 AM, york at orca.akctr.noaa.gov writes:

>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: Complex numbers and MathLink
  • Next by Date: Re: Plotting a step function with the origin indicated
  • Previous by thread: Re: Plotting a step function with the origin indicated
  • Next by thread: Re: Plotting a step function with the origin indicated