Relações: dispersão e linha
Representando duas variáveis juntas.
Relações: dispersão e linha é uma aula grátis de Data Science Academy no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Data Science Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Data Science Academy inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
From One Column to Two
Distributions look at a single column. Now you ask how two columns move together, which is the heart of finding a relationship.
The Scatter Plot
A scatter plot places one dot per row, using two columns as x and y. The cloud of dots reveals how the variables connect.
sns.scatterplot(data=df, x="hours", y="score")Read the Pattern
Dots sloping up mean a positive link, sloping down means negative, and a shapeless blob means little correlation between them.
Add a Third Dimension With hue
Color the dots by a category using hue. Now one plot shows the relationship split across each group at the same time.
sns.scatterplot(data=df, x="hours", y="score", hue="grade")Size Encodes a Fourth Variable
Map a column to dot size to pack in even more. Bigger dots can mean larger sales, population, or any numeric measure.
sns.scatterplot(data=df, x="hours", y="score", size="effort")The Line Plot
When x is ordered, like dates or steps, a line plot connects the points to show how a value changes over that sequence.
sns.lineplot(data=df, x="month", y="revenue")Scatter vs Line
Use a scatter for unordered pairs and a line when the x axis flows in order. Picking the right one keeps the trend honest.
Lines Aggregate Automatically
If several rows share an x value, seaborn averages their y and draws a shaded confidence band around the line for you.
Multiple Lines With hue
Add hue to a line plot and each category becomes its own colored line. Comparing trends across groups takes just one extra word.
sns.lineplot(data=df, x="month", y="revenue", hue="region")Add a Trend Line With regplot
Want the best-fit line drawn through a scatter? regplot overlays a regression line so the direction is impossible to miss.
sns.regplot(data=df, x="hours", y="score")Correlation Is Not Causation
A clear upward cloud shows two things rise together, not that one causes the other. Always pair a plot with judgment.
Quick Check
Your x axis is ordered by month and you want to show change over time.
Recap: Show How Two Things Connect
You can now reveal relationships with scatter for pairs and lines for ordered trends, and add hue or size to layer in more. 🔗
Perguntas Frequentes
A aula “Relações: dispersão e linha” é grátis?
Sim — o texto completo de “Relações: dispersão e linha” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Data Science Academy, atualize para CoddyKit PRO. O curso de Data Science Academy inclui 4 aulas no total.
O que vou aprender em “Relações: dispersão e linha”?
Representando duas variáveis juntas. Você pratica Data Science Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Data Science Academy?
Nenhuma experiência prévia é necessária. Data Science Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.
Quanto tempo leva a aula “Relações: dispersão e linha”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Data Science Academy?
Sim. Cada aula de Data Science Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Por que seaborn em vez de matplotlib puro
- Distribuições: hist, kde e box
- Relações: dispersão e linha
- Facetas, matiz e estilo