Subscribe Bookmark RSS Feed

Puzzled by graph with coloured shapes by frequency

simonp

Community Trekker

Joined:

Feb 24, 2012

Hello:

I have been experimenting with some data trying to plot frequencies on a geographical map with shades determined by frequency. Seems easy? I seem to be technically challenged. I am including an image screenshot of the table with graph builder (may have to click it for better view). I would like the areas to be shaded by the primary dependency with higest number of discharges. The area directly under mouse pointer is FSA B3P. (FSA is a part of a postal code in Canada). However, the highest number of discharges for that area is for Alcohol (see table to the left on the image), but Graph Builder shaded it in green for cannabis. I was going to group it by Single/Poly-substance later. I have experimented with all the summary statistics, thought it should be max but then all areas are shaded as Opioids. (Mean displayed on graph). I must be doing something wrong, please help me understand my problem. I am including the JMP file with data. Also is included the shape files (NSfsa*) which would need to be placed in your map folder.

Thank you very much,

Patrick

1493_TestGraph.jpg

2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

I am not sure how freq works when the coloring column is categorical. It is not working as one would like. However, one way to get the graph that I think you want is to use a summary table with only the maximum category for each polygon & Single/Poly.

Try the script below that illustrates what I mean.

dt=Data Table( "TestGraph" );

dt1=          dt << Summary(

                    Group( :FSA, :Name( "Single/Poly-substance" ) ),

                    Max( :NumberOfDischarges )

          );

dt1<< Update(

                    With( Data Table( "TestGraph" ) ),

                    Match Columns(

                              :FSA = :FSA,

                              :Name( "Max(NumberOfDischarges)" ) = :NumberOfDischarges,

  :Name( "Single/Poly-substance" ) = :Name( "Single/Poly-substance" )

                    ),

                    Add Columns from Update table( :Primary Dependency )

          );

 

          Graph Builder(

          Variables(

                    Group X( :Name( "Single/Poly-substance" ) ),

                    Color( :Primary Dependency ),

                    Shape( :FSA )

          ),

          Elements(

                    Map Shapes(

                              Legend( 1 ),

                              Summary Statistic( "Mean" ),

                              Show Missing Shapes( 1 )

                    )

          ),

          SendToReport(

                    Dispatch(

                              {},

                              "",

                              ScaleBox,

                              {Min( -63.8630934622794 ), Max( -63.379969571381 ), Inc( 0.1 ),

                              Minor Ticks( 1 ), Rotated Labels( "Automatic" )}

                    ),

                    Dispatch(

                              {},

                              "",

                              ScaleBox( 2 ),

                              {Min( 44.5528590425532 ), Max( 44.8341090425532 ), Inc( 0.05 ),

                              Minor Ticks( 1 ), Rotated Labels( "Automatic" )}

                    ),

                    Dispatch(

                              {},

                              "",

                              ScaleBox( 4 ),

                              {Min( 0.413563829787234 ), Max( 0.538563829787234 ), Inc( 0.02 ),

                              Minor Ticks( 0 ), Rotated Labels( "Automatic" )}

                    )

          )

);


simonp

Community Trekker

Joined:

Feb 24, 2012

Thank you very much. I will give the script a whirl and let you know.

Patrick