-
Notifications
You must be signed in to change notification settings - Fork 2
[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
base: main
Are you sure you want to change the base?
Conversation
@@ -6,3 +6,4 @@ plotly | |||
pandas | |||
altair | |||
joblib | |||
sklearn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sklearn | |
scikit-learn |
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
should be conveyed by the plot; (2) the target audience; and (3) the support | ||
of the plot (presentation, website, scientific publication, …). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most scientific journals require fontsize no smaller than 8pts. | |
Most scientific journals require fontsize no smaller than 8pt. |
| 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 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please do 😂
This is work in progress