Reputation: 35
I'm working with a dataset regarding the survivors on the Titanic, where I'm trying to show the relationship between Age of passengers and the fare they paid.
This is what the data is currently formatted as:
from here, it was fairly easy to make a simple scatterplot, like so:
However, I am curious as to if there is a way to set the color of some of the points to be different based on the sex from the dataset. Most examples I have seen across the internet focus on how to change the color for two separate data sets. I initially tried to use an if statement to change the color depending on sex, but that didn't work for me the way I hoped it would.
Upvotes: 0
Views: 80
Reputation: 35
One potential solution I came up to after pondering a bit could potentially look like this as well:
The problem with this solution is you have to add more variables, which isn't ideal, and the results stack over each other a bit making it harder to see the data trends.
Upvotes: 0