Skip to content

Blog - overview #26

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 4 commits into
base: gh-pages
Choose a base branch
from
Open

Blog - overview #26

wants to merge 4 commits into from

Conversation

kdorr
Copy link
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
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.

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
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.

---
## 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
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

```python
alt.Chart(df)
```
Specify what type of glyph/mark should be used to represent your data:
Copy link
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?

```python
mark_point()
```
Then, link your data columns with the encoding channels:
Copy link
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

## 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
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

)
```
## 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
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.

```
Add a scatter plot to the axes object of this figure:
```python
ax.scatter(x_array, y_array)
Copy link
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