Skip to content

[WIP] The Matplotlib chapter #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

[WIP] The Matplotlib chapter #22

wants to merge 3 commits into from

Conversation

NelleV
Copy link
Collaborator

@NelleV NelleV commented Jul 13, 2021

This is work in progress

@@ -6,3 +6,4 @@ plotly
pandas
altair
joblib
sklearn
Copy link
Owner

@jni jni Oct 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sklearn
scikit-learn

Copy link
Owner

@jni jni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I really like this actually! Having said that, I'd add a legend, too. 😊


## Introduction

Matplotlib is probably the most widely used Python package for scientific
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Matplotlib is probably the most widely used Python package for scientific
Matplotlib is the most widely used Python package for scientific


Matplotlib is probably the most widely used Python package for scientific
plotting. While it can be used to create animated, and interactive images, its
main strength is to provide both very quick and easy way to visualize data
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main strength is to provide both very quick and easy way to visualize data
main strength is to provide both a very quick and easy way to visualize data

from an interactive Python terminal **and** the utilities to create scientific
publication-quality figures in a wide range of format.

In this chapter, we are going create a couple of publication quality plot and
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this chapter, we are going create a couple of publication quality plot and
In this chapter, we are going create a couple of publication quality plots and

Comment on lines +45 to +46
should be conveyed by the plot; (2) the target audience; and (3) the support
of the plot (presentation, website, scientific publication, …).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
should be conveyed by the plot; (2) the target audience; and (3) the support
of the plot (presentation, website, scientific publication, …).
should be conveyed by the plot; (2) the target audience; and (3) the medium in
which the plot will appear (presentation, website, scientific publication, …).

should be conveyed by the plot; (2) the target audience; and (3) the support
of the plot (presentation, website, scientific publication, …).

[^QA_and_transcriptomic]: Data visualization is very widely used in genomics
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a callout box rather than a footnote? Also, can you define root and leaf samples?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, as in, from an actual plant. 😂 How about, "if you are running an RNA-Seq study on plant data, and you have a mixture of samples from the roots or leaves of the plant, ..."

Before diving in anything text related with Matplotlib, it's good practice to
set the figure size. Indeed, in Matplotlib, the fontsize are in points, and
not relative to the figure size. The figure size is set in inches. Scientific
publications are typically on A4 papers, while posters are often A0 or A1.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
publications are typically on A4 papers, while posters are often A0 or A1.
publications are typically on A4 paper, while posters are often A0 or A1.

set the figure size. Indeed, in Matplotlib, the fontsize are in points, and
not relative to the figure size. The figure size is set in inches. Scientific
publications are typically on A4 papers, while posters are often A0 or A1.
Most scientific journals require fontsize no smaller than 8pts.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Most scientific journals require fontsize no smaller than 8pts.
Most scientific journals require fontsize no smaller than 8pt.

Comment on lines +300 to +301
| A1 | 594 x 841 mm | 59.4 x 84.1 cm | 23.4 x 33.1 inches |
| A2 | 420 x 594 mm | 42 x 59.4 cm | 16.5 x 23.4 inches |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| A1 | 594 x 841 mm | 59.4 x 84.1 cm | 23.4 x 33.1 inches |
| A2 | 420 x 594 mm | 42 x 59.4 cm | 16.5 x 23.4 inches |
| A1 | 594 x 841 mm | 23.4 x 33.1 inches |
| A2 | 420 x 594 mm | 16.5 x 23.4 inches |


#### Adding x- and y-labels

Let's now set the x-s and y-labels.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Let's now set the x-s and y-labels.
Let's now set the x- and y-labels.


# Let's set the x- and y-labels
ax.set_xlabel("1st component")
ax.set_ylabel("1st component")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ax.set_ylabel("1st component")
ax.set_ylabel("2nd component")

ax.spines["left"].set_position(("data", 0))

# Now set the axis labels & title
ax.set_title("Find a meaningful title", fontweight="bold")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please do 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants