Chris,

Here's an example of where I want a single point. I am plotting several
clusters of points and their centroids. Then I want to show the distance
from a single point in the space (brown marker) to each of those centroids.
Currently, I have to put a second brown marker somewhere (I put it at the
origin) to get the main point to show up.

Skip.


require 'plot'

load 'stats'

dis =:(+/&.:*:@:-)"1 NB. Euclidean Distance

cent=: (+/%#)"2 NB. Centroid for multiple clusters


NB. cl is a cluster generator

NB. It generates a random cluster of 10 points

NB. around x (2=$x) with a spread of y

cl=:4 :'x +"1 y*10 2$rand11 20'


NB. Gen plot. 3 clusters, 3 centroids, random marker

pd 'reset;color red'

pd 'type dot;pensize 5'

pd <"1|:a=:10 20 cl 5

pd 'color blue'

pd <"1|:b=:50 10 cl 10

pd 'color green'

pd <"1|:c=:60 70 cl 12

pd 'color fuchsia'

'd e f' =: cent a,b,:c

pd <"1|:d,e,:f

pd 'color brown'

p =: 55 50

pd 'type marker;markersize 2'

pd <"1|: 0 0,:p

pd 'type line;color blue;pensize 2'

pd <"1 |:d,p,e,p,f,:p

pd 'show'

NB. Euclidean distance from p

( d dis p),(e dis p),(f dis p)


​<<<>>>​


​Skip​



Skip Cave
Cave Consulting LLC

On Tue, Oct 31, 2017 at 2:30 PM, Skip Cave <[email protected]> wrote:

> When i am drawing scatter plots, each point is usually a single dot.
> Different clusters of points are different colored dots. The size & color
> of the dot is set by using pen size or marker size commands, and color
> commands. In some cases, there is only one point of a different color that
> must be displayed, often indicating the centroid of a cluster, or some
> other single point in the space. These single points are usually dots, much
> the same size as other dots around it, but of a different color. Markers
> also work for this as well.
>
> It would be especially nice if I could associate an ascii label to
> specific dots, to help identify certain attributes of specific points in
> the space (centroid1, outlier3, etc.)
>
> Finally, it would be great to associate weights with a series of points,
> which would adjust the dot size of each point. This would  indicate the
> size of the population, or the strength of each point in the space.
>
> Skip
>
> On Oct 31, 2017 6:38 AM, "chris burke" <[email protected]> wrote:
>
>> I agree that the code should not just hang, but what do you expect to see
>> when plotting a single point?
>>
>> On Tue, Oct 31, 2017 at 12:25 AM, 'Skip Cave' via Beta <
>> [email protected]>
>> wrote:
>>
>> > Here's a simple plot:
>> >
>> > load 'plot'
>> >
>> > pd 'reset;color red'
>> >
>> > pd 'type marker;markersize 2'
>> >
>> > pd <"1|:0 0,:10 10
>> >
>> > pd 'show'
>> >
>> >
>> > 1. The above code plots two points, one at 0,0 and one at 10,10. How
>> can I
>> > plot just ONE point? The following code hangs, and shows NO dots at all
>> in
>> > 8.05 & 8.06:
>> >
>> > load 'plot'
>> >
>> > pd 'reset;color red'
>> >
>> > pd 'type marker;markersize 2'
>> >
>> > pd <"1|:10 10
>> >
>> > pd 'show'
>> >
>> >
>> >
>> > Skip Cave
>> > ----------------------------------------------------------------------
>> > 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