Skip to content

Blog - overview#26

Open
kdorr wants to merge 4 commits into
matplotlib:gh-pagesfrom
kdorr:blog-overview
Open

Blog - overview#26
kdorr wants to merge 4 commits into
matplotlib:gh-pagesfrom
kdorr:blog-overview

Conversation

@kdorr
Copy link
Copy Markdown
Collaborator

@kdorr kdorr commented Aug 15, 2018

This is an overview of the different plotting styles between Altair and Matplotlib and a quick how to use mpl-altair.

Copy link
Copy Markdown
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

I think it's mostly solid, like that it's very small but still illustrative. Only change I think it really needs is the tiny shared data so that the examples are runnable.

Comment thread _posts/plotting-overview.md Outdated
excerpt_separator: <!--read more-->
---
## Altair
Altair uses a declarative grammar. As its [overview](https://altair-viz.github.io/getting_started/overview.html) states:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this needs slightly more context. Something like: Altair is a Python visualization library built on top of the Vega/Vegalite declarative grammar.

Comment thread _posts/plotting-overview.md Outdated
---
## Altair
Altair uses a declarative grammar. As its [overview](https://altair-viz.github.io/getting_started/overview.html) states:
>The key idea is that you are declaring links between data columns and visual encoding channels, such as the x-axis, y-axis, color, etc.As the overview states, "the key idea is that you are declaring links between data columns and visual encoding channels, such as the x-axis, y-axis, color, etc."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's some accidental repetition here

Comment thread _posts/plotting-overview.md Outdated
```python
alt.Chart(df)
```
Specify what type of glyph/mark should be used to represent your data:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe glyph/marker to match matplotlib usage?

Comment thread _posts/plotting-overview.md Outdated
```python
mark_point()
```
Then, link your data columns with the encoding channels:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't need comma here

Comment thread _posts/plotting-overview.md Outdated
## Matplotlib
Matplotlib is a powerful object-oriented procedural plotting library. Instead of linking data with encoding channels, Matplotlib uses an object-oriented interface to place objects on a canvas.

The general thought process is to create a plot:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general process to create

Comment thread _posts/plotting-overview.md Outdated
)
```
## Matplotlib
Matplotlib is a powerful object-oriented procedural plotting library. Instead of linking data with encoding channels, Matplotlib uses an object-oriented interface to place objects on a canvas.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this explaination lot! Thought maybe add a sentence/parenthetical on what a canvas is. Or add into the next sentence something like : the general process to create a plot is to first create a figure (canvas) and the subplots (objects containing the images). I'm not liking my explaination of subplots but think it needs something.

Comment thread _posts/plotting-overview.md Outdated
```
Add a scatter plot to the axes object of this figure:
```python
ax.scatter(x_array, y_array)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think both the Altair and mpl examples should be runnable, so I think you should make a teensy dataframe at the top to use with both examples. Something like 'df = pd.DataFrame({'x':[1,2,3,4,5], 'y':[4,5,6,7,8])' You can add a throwaway sentence about how we have data we want to plot and python offers us all the options.

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