Skip to content
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

Not possible to tab complete mark_*() methods in chains #143

Closed
ellisonbg opened this issue Jul 9, 2016 · 4 comments
Closed

Not possible to tab complete mark_*() methods in chains #143

ellisonbg opened this issue Jul 9, 2016 · 4 comments

Comments

@ellisonbg
Copy link
Collaborator

When we use the syntax:

Chart(data).mark_foo()

It isn't possible to tab complete the mark_ unless you are using the non-default Greedy tab completion in IPython. Maybe we should just create the chart as c = Chart(data)? in our tutorial examples?

From @Carreau in #140

@Carreau
Copy link
Contributor

Carreau commented Jul 9, 2016

Question, [which is totally not for v1.0] why:

Chart(cars).mark_point().encode(
    x='Horsepower',
)

and not:

Chart(
    x='Horsepower', ...
).make_point().data(cars)

That would make it much easier to create a reuse a chart:

my chart = Chart(
    x='Horsepower', ...
).make_point()

then mychart.data(truck), mychart.data(kittens)...

@ellisonbg
Copy link
Collaborator Author

You can actually set the data as an attribute later:

c = Chart()
...
c.data = data

However, because the charts are mutable, you would have to do something like:

deepcopy(c).data = data1
deepcopy(c).data = data2

That would be needed even if data were a method too.

@Carreau
Copy link
Contributor

Carreau commented Jul 10, 2016

Yes I've seen that, but then you can't assign the chart to a variable at the same time, as Chart().data = cars return cars. So it is slightly awkward with the current chainable API.

@ellisonbg
Copy link
Collaborator Author

Yeah, although most of the API is attribute based (through traitlets). We
have tried to make a few methods for common things - and those chain. But
the core attribute based API obviously doesn't chain well...

On Sat, Jul 9, 2016 at 8:36 PM, Matthias Bussonnier <
notifications@github.com> wrote:

Yes I've seen that, but then you can't assign the chart to a variable at
the same time, as Chart().data = cars return cars. So it is slightly
awkward with the current chainable API.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ellisonbg/altair/issues/143#issuecomment-231565615,
or mute the thread
https://github.com/notifications/unsubscribe/AABr0EReIoj_hR8Q3Raxl39ybD-iN7Ytks5qUEy0gaJpZM4JIuKM
.

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

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

No branches or pull requests

2 participants