I believe you can easily plot points in 3D space with lines betweens pairs of 
points:

require 'plot'
plot (; 2&o. ; 1&o.) i:10j100

Cheers,
Louis

> On 28 Oct 2017, at 15:12, 'Skip Cave' via Programming 
> <programm...@jsoftware.com> wrote:
> 
> Thanks to Raul & Esa for their very clear instructions and examples for
> plotting points in 2D space.
> 
> I originally thought that my plot post was overlooked, so I re-posted it
> under a more descriptive
> title. Then I saw Raul & Esa's posts, so you can ignore that post.
> In any case, Raul & Esa's answers have resolved part of my requirements.
> 
> However, I need to plot 3D point plots as well. So I may need to look at GNU
> Plot, or
> perhaps Mathematica, to do the 3D plots. I also need to draw lines between
> the pairs of points
> (between each left argument point and it's corresponding right argument
> point) in both 2D & 3D plots.
> 
> I might be willing to pay for someone to update the J plot package to
> handle point plots and lines
> between point pairs. Anyone interested?
> 
> Skip
> 
> <<< >>>
> 
>> On Sat, Oct 28, 2017 at 1:53 AM, Raul Miller <rauldmil...@gmail.com> wrote:
>> 
>> I had to study the plot docs, and experiment a little. The page
>> http://code.jsoftware.com/wiki/Plot/Data is probably the most
>> important to understand.
>> 
>> For your item 1, something like this might work (change the pensize to
>> change the size of the dots - the default size is too small for a
>> graph with only a few dots):
>> 
>>  'type dot;pensize 5' plot ;/|:0 0, 2 _3, _1 2, 1 1,_1 _2,: 3 4
>> 
>> Note, especially, that I used ,: between the last pair of points so
>> these would form into a matrix rather than a long vector. (And then I
>> flipped the matrix on its side with |: and broke it into x and y
>> elements using ;/ so that plot would recognize the data in the way you
>> wanted it to.)
>> 
>> For your item 2, I just now saw Lippu Esa post what looks like a good
>> answer while I was composing this message.
>> 
>> For your item 4 ..  according to
>> http://code.jsoftware.com/wiki/Plot/Types plot currently does not
>> support dot plots for 3d data. I sometimes struggle understanding
>> plot's limitations, but since I have not been prepared to rewrite it,
>> I mostly just accept them as they are. Still, we could use a stick
>> plot:
>> 
>>    'type stick; pensize 5' plot ;/|:_1 _1 _1,0 0 0, 2 _3 1, _1 2 0, 1
>> 1 1,_1 _2 3,: 3 4 2
>> 
>> Sadly, it looks like a stick plot does not adequately show some
>> points. We could work around that by adding another point to force a
>> different bounding box:
>> 
>>  'type stick; pensize 5' plot ;/|:_1 _1 _1,0 0 0, 2 _3 1, _1 2 0, 1 1
>> 1,_1 _2 3,: 3 4 2
>> 
>> There might be a better way?
>> 
>> For your item 5, you can also set the observer viewpoint:
>> 
>>    'type stick; pensize 5; viewpoint _1.6 _2.4 1.5' plot ;/|:0 0 0, 2
>> _3 1, _1 2 0, 1 1 1,_1 _2 3,: 3 4  2
>> 
>> And, finally, for your item 6, you would probably want to break up
>> this one-liner into a sequence of commands, as was illustrated in
>> Lippu Esa's post. (You do get a sequence of commands separated by ; in
>> the left hand argument to plot, but to break up the data and issue
>> commands for different chunks of data you need to work with a sequence
>> of pd statements.)
>> 
>> Thanks,
>> 
>> --
>> Raul
>> 
>> 
>> 
>> 
> ----------------------------------------------------------------------
> 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