Plot/Extensibility

From J Wiki
Jump to navigation Jump to search

The Plot package allows to customize plot parameters to get visual variations, create new graphical solutions from existing or define totally new plot types.

New Solutions from Existing Plot Types

Bubble.png

Visual possibilities of existing plot types are not limited to what can be seen in the plot demo. Sometimes a little creativity can easily exceed the original intentions of certain plot types.

A categorical table from a question in the Forum, Looking for graphical inspiration from Bill Harris, can be represented as a Bubble chart. Although there is no such separate plot type, the effect can be achieved by using the point type and varying the pensize option.

Here we use labels to identify groups, relative positions of the items show their relationship, size represents the level of the relationship, and there is still room for additional detail, such as color to show some additional properties, etc.

Such layout satisfies one of most important principles of Visualization: using little space to convey as many parameters of the model as possible in economical ways without clutter.

label=: [:}:@;('"',,&'" ')each          NB. this fragment can be pasted
diam=:  ('pensize ' <@, ":)"0           NB. to the View Definition window
coord=: $ <@([: ;&,/ 1 + |.@#:)"_ 0 ]   NB. in the Plot Demo
index=: i.@(_1 1&*)@$
view=:  diam ,"0 coord@index
norm=: <.@(* (% >./@,)@(- <./@,))

data=. 10 (0 0;_1 0;_1 _1) } i.4 4    NB. vary indep. 2 2..6 6

colors=. (<'blue') (0 0;_1 0;_1 _1) } ($data)$<'green'
colors=. }:;,&','each  colors

pd 'type point'
pd 'graphbackcolor lightgray'
pd 'gridcolor 230 230 230'
pd 'axes 1 1;axiscolor white'
pd 'xticpos ',":i.2+{:$data
pd 'yticpos ',":i.2+#data
pd 'xlabel ', label (2+{:$data)$<;._1'//L L/H L/L H/H H/'
pd 'ylabel ', label (2+#data)$<;._1'//L L/H L/L H/H H/'
pd 'color ',colors

pd@> view 5+35 norm data

Thanks to Brian Schott for noticing some inconsistencies and helping to improve this example.

-- Oleg Kobchenko <<DateTime(2007-04-06T14:06:04Z)>>

Multi-Pyramid

Multi-pyramid is a way to visualize multi-dimensional arrays with number of axes from 3 to a few more and limited axes lengths.

The structure of the plot is repeated 2D histogram/bar plot made of pyramids. Pyramids make it easy to see through the rows and stacks of such planes. Color can be used to help line up rows or columns.

Multi-Pyramid.png

-- Oleg Kobchenko <<DateTime(2008-07-16T06:44:48Z)>>

Other Customizations

...