Bar Chart
Chart
Example 1
Summary: Creates and customizes a bar chart from data_table.jmp, specifying colors for each level and generating a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Chart(
X( :Type ),
Y( N ),
Level[1] << Colors( 72 ),
Level[2] << Colors( 72 ),
Level[3] << Colors( 72 ),
Level[4] << Colors( 72 ),
Level[5] << Colors( 72 ),
Level[6] << Colors( 72 ),
Bar Chart( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data_table data
- Create chart object.
- Set X-axis variable.
- Set Y-axis variable.
- Customize Level 1 color.
- Customize Level 2 color.
- Customize Level 3 color.
- Customize Level 4 color.
- Customize Level 5 color.
- Customize Level 6 color.
- Generate bar chart.
- Retrieve chart report.
Example 2
Summary: Creates and creates a report for a bar chart from a data table, with customizable colors for each level.
Code:
dt = Open("data_table.jmp");
obj = dt << Chart(
X( :age ),
Y( N ),
Level[1] << Colors( 72 ),
Level[2] << Colors( 72 ),
Level[3] << Colors( 72 ),
Level[4] << Colors( 72 ),
Level[5] << Colors( 72 ),
Level[6] << Colors( 72 ),
Bar Chart( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis to "age".
- Set Y-axis to count.
- Set color for level 1.
- Set color for level 2.
- Set color for level 3.
- Set color for level 4.
- Set color for level 5.
- Set color for level 6.
- Generate bar chart.
- Retrieve chart report.
Example 3
Summary: Creates a bar chart to visualize data by sex, with customized colors for female and male groups.
Code:
dt = Open("data_table.jmp");
obj = Chart(
X( :age ),
Y( N ),
Show Level Legend( 1 ),
Bar Chart( 1 ),
By( :sex ),
SendToByGroup(
{:sex == "F"},
Level[1] << Colors( 3 ),
Level[2] << Colors( 4 ),
Level[3] << Colors( 9 ),
Level[4] << Colors( 8 ),
Level[5] << Colors( 5 ),
Level[6] << Colors( 6 )
),
SendToByGroup(
{:sex == "M"},
Level[1] << Colors( 3 ),
Level[2] << Colors( 4 ),
Level[3] << Colors( 9 ),
Level[4] << Colors( 8 ),
Level[5] << Colors( 5 ),
Level[6] << Colors( 6 )
)
);
rpt = obj << report;
rpt = rpt << parent;
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis to age.
- Set Y-axis to N.
- Enable level legend.
- Use bar chart type.
- Group by sex.
- Customize female group colors.
- Customize male group colors.
- Retrieve and display report.
Example 4
Summary: Creates a bar chart to visualize data from an open JMP data table, with X-axis variable 'Type' and Y-axis variable 'N'.
Code:
Open("data_table.jmp");
obj = Chart( X( :Type ), Y( N ), Bar Chart( 1 ) );
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis variable.
- Set Y-axis variable.
- Configure bar chart type.
Example 5
Summary: Creates a bar chart to visualize data from a specified table, with the age variable on the X-axis and N values on the Y-axis.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ) );
Code Explanation:
- Open data table.
- Create chart object.
- Set X-axis variable.
- Set Y-axis variable.
- Specify bar chart type.
- Execute chart creation.
Example 6
Summary: Creates a bar chart to visualize count data by age and sex, utilizing the Chart platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age, :sex ), Y( N ), Bar Chart( 1 ) );
Code Explanation:
- Open data table.
- Create chart object.
- Set X-axis to "age" and "sex".
- Set Y-axis to count (N).
- Display bar chart.
Example 7
Summary: Creates a bar chart to visualize age distribution by sex, utilizing the JMP scripting language.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ), By( :sex ) );
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis to "age".
- Set Y-axis to count.
- Use bar chart type.
- Group by "sex".
Example 8
Summary: Creates a bar chart to visualize count data by sex, with age as the x-axis.
Code:
dt = Open("data_table.jmp");
obj = Chart( Grouping( :sex ), X( :age ), Y( N ), Bar Chart( 1 ) );
Code Explanation:
- Open data table.
- Create chart object.
- Group by sex variable.
- Set age as X-axis.
- Set count as Y-axis.
- Generate bar chart.
Example 9
Summary: Creates a bar chart to visualize data by age and sex, with configurable colors for level 1 and level 2 variables.
Code:
Open("data_table.jmp");
obj = Chart( X( :age, :sex ), Y( N ), Level[1] << Colors( 24 ), Level[2] << Colors( 12 ), Bar Chart( 1 ) );
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis variables.
- Set Y-axis variable.
- Configure level 1 colors.
- Configure level 2 colors.
- Create bar chart.
Example 10
Summary: Creates a bar chart to visualize data from 'data_table.jmp', with X-axis variables set to 'age' and 'sex', Y-axis variable set to 'N', and color applied to Level 1 and Level 2 bars.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age, :sex ), Y( N ), Level[1] << Colors( 78 ), Level[2] << Colors( "green" ), Bar Chart( 1 ) );
Code Explanation:
- Open data_table data
- Create chart object.
- Set X-axis variables: age, sex.
- Set Y-axis variable: N.
- Apply color to Level 1 bars.
- Apply green color to Level 2 bars.
- Configure bar chart type.
Example 11
Summary: Creates a bar chart to visualize count data by age and sex, with color-coded levels.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age, :sex ), Y( N ), Level[2] << Colors( 32 ), Bar Chart( 1 ) );
Code Explanation:
- Open data table.
- Create chart object.
- Set X variables: age, sex.
- Set Y variable: count.
- Configure level display: 2 levels.
- Apply color scheme: 32 colors.
- Generate bar chart.
Example 12
Summary: Creates a bar chart with customized colors and settings, using the age variable as the X-axis and N as the Y-axis.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Level[1] << Colors( 78 ), Bar Chart( 1 ) );
Code Explanation:
- Open data table;
- Create chart object.
- Set X axis to age.
- Set Y axis to N.
- Set level to 1.
- Apply color scheme 78.
- Enable bar chart.
Example 13
Summary: Creates a bar chart with count data, setting the X-axis to 'age' and colors to 78.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ) );
obj << (Level[1] << Colors( 78 ));
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis to "age".
- Set Y-axis to count.
- Add bar chart type.
- Access first level.
- Set colors to 78.
Example 14
Summary: Creates a bar chart with age on the X-axis and N on the Y-axis, using color 78 for the first level.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ) );
obj << Level[1] << Colors( 78 );
Code Explanation:
- Open data table.
- Create chart object.
- Set X axis to age.
- Set Y axis to N.
- Use bar chart type.
- Access first level settings.
- Set color to 78.
Example 15
Summary: Creates a bar chart with custom color settings, utilizing the Chart() function and specifying X-axis and Y-axis variables.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ) );
(obj << Level[1]) << Colors( 78 );
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis variable.
- Set Y-axis variable.
- Choose bar chart type.
- Access first level.
- Set color to 78.
Example 16
Summary: Creates a bar chart with X-axis set to 'age' and Y-axis set to 'N', using color index 78.
Code:
dt = Open("data_table.jmp");
obj = Chart( X( :age ), Y( N ), Bar Chart( 1 ) );
obj << Colors( 78 );
Code Explanation:
- Open data table;
- Create chart object.
- Set X-axis to age.
- Set Y-axis to N.
- Use bar chart type.
- Assign color index 78.