Skip to main content
Version: 0.17.6

Explore Data with Simple Plots

Plots are a great way to start exploring your data and identifying trends. In this example, we'll explore the data about the passengers aboard the Titanic.

Load Our Data

To start, use the utterance below to load in the dataset.

Load data from the file titanic.csv

Create a Simple Scatter Chart

tip

DataChat supports a number of plots. You can use the Help skill to view all of the available plots and some example utterances.

First, let's explore the relationship between a passenger's age and the fare they paid to board the Titanic. We can use the utterance below to create a scatter plot showing each passenger's age and the fare they paid. We'll also split the passengers by gender and add a slider (which lets us manipulate the value of a specific variable) so we can see how each of the passenger classes compare:

Plot a scatter chart with the x-axis Age, the y-axis Fare, for each Gender, and sliding by Pclass

After running that utterance, we see a chart that looks like this:

scatter chart

We can see that, predictably, the fares are lower as you move from first class to second class to third class. What's interesting here is that the fares for women (the blue dots) seem to be generally be higher for men (the gold stars) across the classes. Let's explore that trend with some light computations and a new chart.

Compute and Then Plot

We can compute the average fare paid by each gender for each passenger class with the utterance:

Compute the average Fare for each Gender, Pclass

Now, let's use a bar chart to compare the average fare paid by men and by women in each passenger class. We can use the following utterance to build our chart:

Plot a bar chart with the x-axis Pclass, the y-axis AverageFare, for each Gender

After running that utterance, we see a chart like this:

scatter chart

We can see that the trend we noticed earlier holds true. This chart clearly illustrates that, on average, women paid more than men regardless of their class.

Full Workflow

You can copy all of the utterances we used in this example here:

Record a blue note <strong>First, we load in the data we want to use.</strong>
Load data from the file <strong>titanic.csv</strong>
Record a blue note <strong>let's explore the relationship between a passenger's age and the fare they paid to board the Titanic. We can use the utterance below to create a scatter plot showing each passenger's age and the fare they paid. We'll also split the passengers by gender and add a slider (which lets us manipulate the value of a specific variable) so we can see how each of the passenger classes compare.</strong>
Plot a scatter chart with the x-axis Age, the y-axis Fare, for each Gender, and sliding by Pclass
Record a blue note <strong>We can see that, predictably, the fares are lower as you move from first class to second class to third class. What's interesting here is that the fares for women (the blue dots) seem to be generally be higher for men (the gold stars) across the classes. Let's explore that trend with some light computations and a new chart.</strong>
Compute the average Fare for each Gender, Pclass
Record a blue note <strong>Now, let's use a bar chart to compare the average fare paid by men and by women in each passenger class. We can use the following utterance to build our chart.</strong>
Plot a bar chart with the x-axis Pclass, the y-axis AverageFare, for each Gender
Record a blue note <strong>We can see that the trend we noticed earlier holds true. This chart clearly illustrates that, on average, women paid more than men regardless of their class.</strong>