I needed to draw some bar plots with lines over them and noticed that if you don't take special care the points of the line do not correspond to the centers of the bars. This can be seen in this example:
load 'plot' DATA=. 1 2 3 2.5 4 0.5 1 pd 'reset' pd 'type bar;barwidth 1' pd DATA pd 'type line marker;color black;' pd (1.5"0)DATA pd 'show' So I tried adjusting the line a bit to correct the alignment. The best I could come up with is this: DATA=. 1 2 3 2.5 4 0.5 1 pd 'reset' pd 'type bar;barwidth 1' pd DATA pd 'type line marker;color black;' pd (((0.5 * [:i: _1: j. <:@#) + i...@#) ; 1.5"0) DATA pd 'show' This works ok but as the widths of the bars increase the discrepancy becomes more noticeable. You can see it by increasing the width of the plot window. Does anyone know the exact formula to get the markers in the centers of the bars? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
