Skip to content

Commit

Permalink
Merge pull request #467 from JosephBARBIERDARNAL/scatter
Browse files Browse the repository at this point in the history
update scatter plot with seaborn section
  • Loading branch information
holtzy committed Aug 7, 2024
2 parents cd4d641 + e893750 commit 22f63a4
Show file tree
Hide file tree
Showing 12 changed files with 951 additions and 216 deletions.
180 changes: 153 additions & 27 deletions src/notebooks/40-basic-scatterplot-seaborn.ipynb

Large diffs are not rendered by default.

146 changes: 121 additions & 25 deletions src/notebooks/41-control-marker-features.ipynb

Large diffs are not rendered by default.

138 changes: 115 additions & 23 deletions src/notebooks/42-custom-linear-regression-fit-seaborn.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

42 changes: 30 additions & 12 deletions src/notebooks/44-control-axis-limits-of-plot-seaborn.ipynb

Large diffs are not rendered by default.

54 changes: 39 additions & 15 deletions src/notebooks/45-control-color-of-each-marker-seaborn.ipynb

Large diffs are not rendered by default.

119 changes: 78 additions & 41 deletions src/notebooks/46-add-text-annotation-on-scatterplot.ipynb

Large diffs are not rendered by default.

298 changes: 298 additions & 0 deletions src/notebooks/47-faceted-scatter-plot-with-seaborn.ipynb

Large diffs are not rendered by default.

52 changes: 42 additions & 10 deletions src/pages/scatter-plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const quickCode = `# library & dataset
import seaborn as sns
df = sns.load_dataset('iris')
# use the function regplot to make a scatterplot
sns.regplot(x=df["sepal_length"], y=df["sepal_width"])
# use the function scatterplot() to make a scatterplot
sns.scatterplot(x=df["sepal_length"], y=df["sepal_width"])
`;

const quickCodeMatplotlib = `# libraries
Expand Down Expand Up @@ -88,9 +88,9 @@ export default function ScatterPlot() {
<Row className="align-items-center">
<Col md={6}>
<p>
The <code>regplot()</code> function of the <code>Seaborn</code>{' '}
library is definitely the best way to build a scatterplot in
minutes. 🔥
The <code>scatterplot()</code> function of the{' '}
<code>Seaborn</code> library is definitely the best way to build a
scatterplot in seconds. 🔥
</p>
<p>
Simply pass a numeric column of a data frame to both the{' '}
Expand Down Expand Up @@ -179,11 +179,6 @@ export default function ScatterPlot() {
caption="Most basic scatterplot with seaborn"
linkTo="/40-basic-scatterplot-seaborn"
/>
<ChartImageContainer
imgName="42_Scatterplot_custom_linear_fit_seaborn"
caption="Add a regression thanks to the fit_reg parameter"
linkTo="/42-custom-linear-regression-fit-seaborn"
/>
<ChartImageContainer
imgName="41_Scatterplot_change_marker_shape_seaborn"
caption="Customize markers: color, size, opacity, type and more"
Expand All @@ -210,6 +205,43 @@ export default function ScatterPlot() {
linkTo="/46-add-text-annotation-on-scatterplot"
/>
</Row>
<br />
<p>
A nice way to add info and highlight trend in a scatter plot is to add
a <b>regression line</b> on top of the dots. Thanks to its{' '}
<code>regplot()</code> and <code>lmplot()</code> function, it&apos;s
quite easy!
</p>
<p>
The main difference between those 2 functions are that:
<ul>
<li>
<code>regplot()</code> is used for simple scatter plot with a
trend line
</li>
<li>
<code>lmplot()</code> can also be used for <b>facetting</b>: e.g
creating multiple scatter plots
</li>
</ul>
</p>
<Row>
<ChartImageContainer
imgName="42_Scatterplot_custom_linear_fit_seaborn"
caption="Add a regression thanks to the fit_reg parameter"
linkTo="/42-custom-linear-regression-fit-seaborn"
/>
<ChartImageContainer
imgName="47-faceted-scatter-plot-with-seaborn-1"
caption="Split scatter plot by a category"
linkTo="/47-faceted-scatter-plot-with-seaborn"
/>
<ChartImageContainer
imgName="47-faceted-scatter-plot-with-seaborn-2"
caption="Faceted scatter plot with regression line"
linkTo="/47-faceted-scatter-plot-with-seaborn"
/>
</Row>
</Container>

<Spacing />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 22f63a4

Please sign in to comment.