Clarification:
Hm, actually it showed automatically the first time, but then needed a pd
'show' for subsequent reruns, unless the plot window was closed.


On 25 April 2014 07:20, Alex Giannakopoulos <[email protected]> wrote:

> Yup, interesting.
> I would add, though, that in the simple example I gave above, I did not
> have to use, pd 'show', it seemed to do so automatically.
> Implementation change?
>
>
> On 25 April 2014 07:12, Raul Miller <[email protected]> wrote:
>
>> I think it is.
>>
>> But the data needs to be changed slightly.
>>
>> (I have been mostly ignoring plot and pd myself, and I just now went
>> through the plot lab.)
>>
>> An important thing to understand seems to be that
>>
>>     H=:|:|.V=:j./~i:2j8
>>
>>    'pensize 2;color 50 255 255' plot H,V
>>
>> is at least roughly equivalent to:
>>
>>    pd 'reset'
>>    pd 'pensize 2;color 50 255 255'
>>    pd H,V
>>    pd show
>>
>> In other words, you can just call pd twice, once with the left argument
>> for
>> plot and once with the right argument. But since pd is breaks things out
>> into steps, you also need to start with a pd 'reset' and then do a pd
>> 'show' at the end.
>>
>> Basically, pd can tell whether you have given character data (options) or
>> numeric data (which needs to be plotted). In fact, hypothetically
>> speaking,
>> plot could maybe be rewritten as:
>>
>> plot=:3 :0
>>   '' plot y
>> :
>>   pd 'reset'
>>   pd x
>>   pd y
>>   pd 'show'
>> )
>>
>> That's not how it works though (and I wonder what issues the current
>> implementation of plot addresses which I am currently unaware of - but
>> that's not important right now).
>>
>> Anyways, once you have the grid plotted, you can add another plot to the
>> display by doing another sequence of pd instructions for the parabola, but
>> without the 'reset'.
>>
>>    P=: 2<.*:i:2j32
>>
>>    pd 'pensize 2;color BLUE'
>>    pd P
>>    pd 'show'
>>
>> Note that since we did not do a 'reset' here, we get to keep what we have
>> already displayed.
>>
>> The problem is that the implied X axis for the parabola (0 to 32) is not
>> the same size as the grid (_2 to 2). So it looks "wrong".
>>
>> To fix this, we need to explicitly specify the values for the X axis of
>> the
>> parabola:
>>
>>    pd 'reset'
>>    pd 'pensize 2;color 50 255 255'
>>    pd H,V
>>    pd 'pensize 2;color BLUE'
>>    pd (i:2j32);P
>>    pd 'show'
>>
>> Finally, note that, if you prefer,
>>
>>    require 'numeric'
>>    steps _2 2 32
>>
>> could have been used instead of i:2j32.
>>
>> (I am avoiding the use of the definition of 'do' for generating the X
>> values, because J already supplies a definition for 'do' which does
>> something different.)
>>
>> Thanks,
>>
>> --
>> Raul
>>
>>
>>
>>
>> On Fri, Apr 25, 2014 at 1:43 AM, Alex Giannakopoulos <
>> [email protected]> wrote:
>>
>> > Otherwise (having just looked in the Labs) I think the "pd" verb may
>> allow
>> > you to plot different size data on the same plot.  I haven't used it
>> yet,
>> > I'll check it out now, but it may be what you need.
>> >
>> >
>> > On 25 April 2014 06:36, Alex Giannakopoulos <[email protected]>
>> > wrote:
>> >
>> > > ... contd
>> > >
>> > > Using (]+0j1*P) or similar
>> > >
>> > > Also I think the intervals must be the same on one plot.  If you try
>> to
>> > > mix an 8-interval with a 32-interval matrix, the 8-matrix will get
>> padded
>> > > with 0s or 0j0s, rendering a nice spider's web in the latter case.
>>  You
>> > > will need to pad the 8-matrix with the values of the terminal points
>> to
>> > > avoid this.
>> > >
>> > >
>> > > On 25 April 2014 06:15, alexgian <[email protected]> wrote:
>> > >
>> > >> Further, you seem to have specified your grid in the Argand plane, I
>> > >> don't think you can mix and match with reals just like that (I may be
>> > wrong
>> > >> - certainly no expert on J plotting).
>> > >> So you'd have to translate your parabola to complex coords if you
>> wanted
>> > >> to display it in the same context, I think.
>> > >>
>> > >>
>> > >> On 25 April 2014 06:00, alexgian <[email protected]> wrote:
>> > >>
>> > >>> Not quite sure what you're trying to do, but would this be a step in
>> > the
>> > >>> right direction?
>> > >>>
>> > >>>
>> > >>>    load 'plot'
>> > >>>
>> > >>>    do=: 13 :'({.y) +(i.>:{:y)*(--/ 2{.y)%{:y'
>> > >>>
>> > >>>    G=:do _2 2 32
>> > >>>
>> > >>>    P=: 2 <. *:
>> > >>>
>> > >>>    plot (];P) G
>> > >>>
>> > >>>
>> > >>> In your version you have not specified x-coordinates, so it picks
>> 0-32.
>> > >>>
>> > >>> By using ] you specify the x-range
>> > >>>
>> > >>>
>> > >>> Also note that that you do not need "do", there is a plot builtin
>> > called
>> > >>> "steps":
>> > >>>
>> > >>>    plot (];P) steps _2 2 32
>> > >>>
>> > >>> would achieve the same result
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>> On 25 April 2014 01:25, Linda Alvord <[email protected]>
>> wrote:
>> > >>>
>> > >>>> Can anyone help me put the parabola, P, on the graph paper without
>> > >>>> changing
>> > >>>> the scales of the graph paper.
>> > >>>>
>> > >>>>    load 'plot'
>> > >>>>    do=: 13 :'({.y) +(i.>:{:y)*(--/ 2{.y)%{:y'
>> > >>>>    A=:do _2 2 8
>> > >>>>    V=:j./~ A
>> > >>>>    H=:|:|. V
>> > >>>>    'pensize 2;color 50 255 255' plot H,V
>> > >>>>
>> > >>>>    f=:*:
>> > >>>>    'pensize 2;color BLUE' plot P=: 2 <. f do _2 2 32
>> > >>>>
>> > >>>> Linda
>> > >>>>
>> ----------------------------------------------------------------------
>> > >>>> For information about J forums see
>> > http://www.jsoftware.com/forums.htm
>> > >>>>
>> > >>>
>> > >>>
>> > >>
>> > >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to