Replacing the existing functionality would be ideal. There is
currently one caveat however. I defined the "sbarn" type to be
treating as a line graph when drawing the x-axis labels. The bar graph
types always draw every label by default. I prefer it this way but
some may not. In that case I would suggest treating the new stacked
bar graph as a bar graph for drawing labels and updating the area
graph in a similar way.

On Wed, Nov 11, 2009 at 3:36 AM, Sherlock, Ric
<[email protected]> wrote:
> I was thinking along similar lines . The current stacked bar disallows 
> negative values (gives error). Thomas' version should produce the same 
> results as the current one for datasets without negatives. So with his 
> suggested  changes to getmin and getmax and replacing the current 
> makestackbar with makestackbarn we would just have a more functional sbar 
> type. Any downsides?
>
> Sent from my Windows® phone.
>
> -----Original Message-----
> From: Oleg Kobchenko <[email protected]>
> Sent: Wednesday, 11 November 2009 21:01
> To: Programming forum <[email protected]>
> Subject: Re: [Jprogramming] Stacked Bar Chart
>
>
> If signed bars is a superset of regular bars, should it an enhancement to
> existing bar type, rather than a new type?
>
>
>
> On Nov 10, 2009, at 11:33 AM, Thomas Costigliola <[email protected]> wrote:
>
> Thank you for the information. Option 1 led me to great example code
> so I went ahead and added a new chart type. There had to be some
> changes to other functions within the jzplot class so I updated the
> whole class. I attempted to make a subclass but was unsuccessful. All
> the results can be found here:
>
> http://www.jsoftware.com/jwiki/Improved%20Stacked%20Bar%20Graph
>
> On Sun, Nov 8, 2009 at 5:08 AM, Sherlock, Ric <[email protected]> 
> wrote:
> From: Thomas Costigliola
>
> I would like to create a chart like the one in the link below. It is a
> stacked bar chart with no space between the bars. Plot doesn't seem to
> allow negative values in stacked bar charts. Is there any work around
> for this? There would also need to be a way to draw the bars next to
> each other as in a histogram.
>
> The given plot was produced with R; it has an incredibly flexible
> plotting package.
>
> http://www.jsoftware.com/jwiki/ThomasCostigliola
>
> The gap between bars can be adjusted using the "barwidth" option.
> "http://www.jsoftware.com/jwiki/Plot/Options";
>
>  'bar;barwidth 1;' plot 3 9 8 _3 9 _7
>
> However I don't think you're going to to get the output you're after using 
> existing plot types and options in J.
> I see two main avenues of choices:
>
> 0. Use the stats/r/rserve addon (interface to R) to create your chart from J 
> data using R.
> Below is a very basic example of how you could create an R chart as a PDF 
> from J.
>
>  load 'stats/r/rserve task'
>  Rcmd 'x<- seq(-10,10,length=50)'
>  Rcmd 'y<- x'
>  Rcmd 'foo<- function(x,y){r<-sqrt(x^2+y^2);10*sin(r)/r}'
>  Rcmd 'z<- outer(x , y , foo)'
>  Rcmd 
> 'pdf(file="c:\\users\\rsherloc\\documents\\j602-user\\temp\\RicRplot001.pdf")'
>  Rcmd 'persp(x,y,z,theta=30,phi=30,expand=0.5,xlab="X",ylab="Y",zlab="Z")'
>  Rcmd 'dev.off()'
>  launch jpath '~temp/RicRplot001.pdf'
>
> For your purposes you'd want to send the raw data from J to R for plotting 
> rather than create in R as in the above example (otherwise you might as well 
> just do the whole thing in R!?!
>
> 1. Create a new custom chart type
> There was a good thread on modifying and combining existing chart types in 
> the forums about a year ago where Oleg gave an example of how to write a 
> custom plot type.
> "http://www.jsoftware.com/pipermail/programming/2008-November/013009.html";
>
> I've got a draft of a wiki page summarizing the thread somewhere that I must 
> get around to adding to the wiki.
>
>
>
> ----------------------------------------------------------------------
> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to