I was assuming you wanted to plot _only_ a horizontal line, which is
difficult because plot scales according to the data.  So, if I plot a
constant function:

   const=: 4 : 'x[y'"0
   plot _10 10;'5&const'

I get a blank plot: there is no line and no labels on the Y-axis because it
has height zero.  We could fake it by playing with the palette:

   STDCLR_jwplot_=: 0 0 255,255 255 255,:255 255 255 NB. Blue, white, white
   plot _10 10;'5&const`0&const`10&const'   NB. Plot 3 lines but can only
see the first one.

This seems kind of silly but it raises an important point, something that is
a flaw in most plotting packages: there's often not a way to specify the
bounds of an axis apart from the extremes of the data.

This is particularly critical if I'm plotting multiple items separately and
comparing them side-by-side: a graph of the US dollar versus the Hong Kong
dollar (HKD - which is fixed) looks very similar to that of the US dollar
versus an independent currency - it's only when you pay attention to the
value on the Y-axis that you would notice the extremes of HKD plot are a
small fraction of a percent apart.  I'd like to be able to scale the axes of
each plot according to the extremes across all my datasets.

Anyway, I'm glad other people gave examples more germane to the particular
problem submitted.

On 3/13/08, Sherlock, Ric <[EMAIL PROTECTED]> wrote:
>
> ---Bill Harris wrote:
> > Looking at http://www.jsoftware.com/jwiki/Plot/Function, I
> > figured out I
> > could plot a 45 degree line with
> >
> >       plot _10 10 ; 'y'
> >
> > and multiplying y by a slope gives other lines.
> >
> > How do I plot a horizontal line?  I'm trying to draw limit lines on a
> > graph.
>
>
> This works for me, but there may be better ways.
> plot _10 10 ; 'y`4+y-y'
>
>
> > Finally, I have data I'm plotting as a marker type graph; is
> > it easy to
> > overlay the limit lines as type lines?  When I issue pd'marker; show'
> > (assuming I do the data last), it switches everything to markers.
>
>
>    pd 'reset'
>    pd 'type marker'
>    pd _10 _9 _8 _7 _6 _5 _4 _3 ; _10 _5 _1 2 3 3.5 3.75 3.875
>    pd 'type line'
>    pd _10 0; '4+y-y'
>    pd 'show'
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to