cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
jump
Level II

How to preserve rows states\color for a graph builder using bar chart

Hi,

i am building a graph using JSL and graph builder . I have data set where i assign row_states\colors\markers by a (for loop) as no. of rows keep changing with every data set. Now when i plot a bar chart with Graph builder, these rows states do not set the color marked for each row in bar chart.

Is there something missing while setting up graph builder  in JSL, as same rows show right colors when i plot a variability plot.

Can someone help answer this question?

thx

1 ACCEPTED SOLUTION

Accepted Solutions
julian
Community Manager Community Manager

Re: How to preserve rows states\color for a graph builder using bar chart

Hi Jump,

I modified your script to include   Color( :Test Name )  in the variable declaration (bolded below). This will apply coloring to the bars on the basis of the levels of test name. Does this do what you want?

----

Yield_Graph_by_Test = Yield_table << Graph Builder(

     Size( 1145, 894 ),

     Automatic Recalc( 0 ),

     Variables( X( :Test Name ), Y( :Name( "Fallout(%)" ) ), Color( :Test Name ) ),

     Elements(

           Bar(X,Y,Legend( 2 ),Bar Style( "Side by side" ),Summary Statistic( "Mean" ))),

     SendToReport(

           Dispatch({},"Graph Builder",OutlineBox,{Set Title( "Fallout(%) Vs. BE Test " )}),

           Dispatch({},"Fallout(%)",ScaleBox,{Min( 0 ), Max( 100 ), Inc( 2 ), Minor Ticks( 0 )}),

           Dispatch({},"", ScaleBox,{Min( 0 ), Max( 100 ), Inc( 1 ), Minor Ticks( 0 )}),

           Dispatch({},"graph title",TextEditBox,{Set Text( "(Fallout(%)) vs. Test Name" )}))

);





View solution in original post

9 REPLIES 9
julian
Community Manager Community Manager

Re: How to preserve rows states\color for a graph builder using bar chart

Hi Jump,

I think I'm understanding your question but If you share your jsl code I would be happy to take a look.


Generally though, bar charts in JMP are not sensitive to row colors or markers. Row colors and markers apply to points, which is why the variability plot (or a scatter plot, or any platform rendering points) will show those row markers and colors. In order to color bars in graph builder you will need to use the "overlay" or "color" role.  It might seem odd that bars don't inherit their colors from row states, but consider that bar charts are usually displaying an aggregation of data (e.g. average of all individuals in a group, for instance) and unless the group is completely homogeneous with respect to color states there isn't a single color that could be displayed to represent everyone. JMP will make an attempt if you use the "color" role in graph builder, and will average the constituent colors for a given group and use that average for the bar color.


I hope I've interpreted your question correctly and this helps! If you reply with your code or specific example I would be happy to help further.


Julian


jump
Level II

Re: How to preserve rows states\color for a graph builder using bar chart

Hi Julian,

thx for quick reply. I think you got my question and answered it right. Below is my script.

Yield_Graph_by_Test = Yield_table << Graph Builder(

     Size( 1145, 894 ),

     Automatic Recalc( 0 ),

     Variables( X( :Test Name ), Y( :Name( "Fallout(%)" ) ) ),

     Elements(

           Bar(X,Y,Legend( 2 ),Bar Style( "Side by side" ),Summary Statistic( "Mean" ))),

     SendToReport(

           Dispatch({},"Graph Builder",OutlineBox,{Set Title( "Fallout(%) Vs. BE Test " )}),

           Dispatch({},"Fallout(%)",ScaleBox,{Min( 0 ), Max( 100 ), Inc( 2 ), Minor Ticks( 0 )}),

           Dispatch({},"", ScaleBox,{Min( 0 ), Max( 100 ), Inc( 1 ), Minor Ticks( 0 )}),

           Dispatch({},"graph title",TextEditBox,{Set Text( "(Fallout(%)) vs. Test Name" )}))

);




so each test name has a color attached to it  and i want that to show up in Bar chart so we can identify it clearly. i am plotting fallout% by test as you can see it in script above.

Can you help with the overlay\color part of the script

thanks

julian
Community Manager Community Manager

Re: How to preserve rows states\color for a graph builder using bar chart

Hi Jump,

I modified your script to include   Color( :Test Name )  in the variable declaration (bolded below). This will apply coloring to the bars on the basis of the levels of test name. Does this do what you want?

----

Yield_Graph_by_Test = Yield_table << Graph Builder(

     Size( 1145, 894 ),

     Automatic Recalc( 0 ),

     Variables( X( :Test Name ), Y( :Name( "Fallout(%)" ) ), Color( :Test Name ) ),

     Elements(

           Bar(X,Y,Legend( 2 ),Bar Style( "Side by side" ),Summary Statistic( "Mean" ))),

     SendToReport(

           Dispatch({},"Graph Builder",OutlineBox,{Set Title( "Fallout(%) Vs. BE Test " )}),

           Dispatch({},"Fallout(%)",ScaleBox,{Min( 0 ), Max( 100 ), Inc( 2 ), Minor Ticks( 0 )}),

           Dispatch({},"", ScaleBox,{Min( 0 ), Max( 100 ), Inc( 1 ), Minor Ticks( 0 )}),

           Dispatch({},"graph title",TextEditBox,{Set Text( "(Fallout(%)) vs. Test Name" )}))

);





jump
Level II

Re: How to preserve rows states\color for a graph builder using bar chart

thank you .. it works.

I have one more question .. what  "levels of test name" mean? Reason i am asking is ,because i am going to run multiple datasets. For e very data set the color attached to these test will be same? it will help with consistency.

P.S : I  have one more question regarding selecting grouping columns on X- axis in variability plot using JSL display box window. i will post it as different discussion.

thx again

julian
Community Manager Community Manager

Re: How to preserve rows states\color for a graph builder using bar chart

Fantastic! Glad that worked for you

When I said "levels of test name" I meant that JMP would apply a color to each category that exists in that variable for the particular dataset. If you are using this script on different data sets that all have the same categories then the colors picked by default will all be the same. If you have more or fewer test name categories (levels of the variable "test name") in some datasets than others, the color scheme may change. Do all your datasets have the same values in the "test name" column? If not, there are still things we can do to make sure you have a consistent color scheme for the shared categories across datasets (levels of that test name variable).

I hope this helps!

Julian

jump
Level II

Re: How to preserve rows states\color for a graph builder using bar chart

This works as my no. of test name and test name it self is going to be constant.

thx ... for all quick replies. I really appreciate it.

///////////////////////////////////////////////////////////////////////////////////

I have one more question if i can throw it in this thread . In a Variability Summary Report , Enabled from  Variability plot.

Is there a way to enable median of each dataset?? as mean alone is not helpful .

julian
Community Manager Community Manager

Re: How to preserve rows states\color for a graph builder  using bar chart

Great!

Unfortunately I don't know of a way to change the default reported statistics in the variability summary report. But, a table just like the one returned there can be generated through Analyze >> Tabulate (and the script can be saved if you are creating a lot of these tables). If you haven't used tabulate before, it's a drag and drop table creation platform. In this instance, you would take your Y variable and drop it in the center of the blank table. The "Sum" will be calculated by default, but if you wish to have median, stdev, min/max etc, select those statistics in the list of available statistics and at once drag the group of them on top of "Sum" to replace it with the new statistics (the square in which the sum is shown should highlight as you hover over that drop zone). You should have the aggregate stats now for your Y variable, and to break these values apart by another variable, like part id, or grouping variables, select the grouping variables in your list of columns and drag them to the drop zone for rows (the blank row square to the left of the table. You should now have the summary table including the median.

Hopefully this helps!

Julian

jump
Level II

Re: How to preserve rows states\color for a graph builder using bar chart

ok .. i am aware of tabulate method.  but i was hoping it to be part of the jrn with plot  and variability summary report.

thx .. hopefully an additions for JMP12 

jump
Level II

Re: How to preserve rows states\color for a graph builder  using bar chart

Also,  Below is the link to my other question regarding col list box ,,

https://community.jmp.com/message/213027#213027  

if you can help or direct me to right help.. thx