Blog - overview#26
Conversation
story645
left a comment
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
There's some accidental repetition here
| ```python | ||
| alt.Chart(df) | ||
| ``` | ||
| Specify what type of glyph/mark should be used to represent your data: |
There was a problem hiding this comment.
Maybe glyph/marker to match matplotlib usage?
| ```python | ||
| mark_point() | ||
| ``` | ||
| Then, link your data columns with the encoding channels: |
| ## 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: |
| ) | ||
| ``` | ||
| ## 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. |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
Still need to make example plots runnable.
This is an overview of the different plotting styles between Altair and Matplotlib and a quick how to use mpl-altair.