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

Prefer method-based syntax in docs and add tabbed interface for method and attribute syntax in gallery #2983

Merged
merged 24 commits into from
Mar 29, 2023

Conversation

joelostblom
Copy link
Contributor

Following up on the discussion in #2599 (reply in thread) to make the method-based channel option syntax the default in the docs. This PR prefers that syntax throughout the narrative documentation and includes both the method-based and attribute-syntax for the gallery examples in a tabbed interface so that there are some examples for users prefer this syntax (and since we will preserve these snippets for testing purposes anyways). The only thing left to update is the interactivity section, which I can address after #2981 is merged.

Example of how the gallery looks now:

image

@joelostblom joelostblom changed the title Tabbed interface for method and attribute syntax Prefer method-based syntax in docs and add tabbed interface for method and attribute syntax in gallery Mar 23, 2023
Copy link
Contributor

@binste binste left a comment

Choose a reason for hiding this comment

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

Awesome to have the whole documentation show the method-based approach! I use the new syntax myself all the time and find it very convenient.

Although it's still a draft, I already reviewed the suggested changes so far. I can go through the interactivity section as well once it's ready.

).properties(
title='By Channel'
)

# Sort according to another field
sortfield = base.encode(
alt.X(field='site', type='nominal',
sort=alt.EncodingSortField(field='yield', op='min'))
alt.X('site:N').sort(field='yield', op='max')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it an intentional change from op='min' to max?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't see a change in the sort order in the current docs with min:

image

Copy link
Contributor Author

@joelostblom joelostblom left a comment

Choose a reason for hiding this comment

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

Great, thank you! I accepted all your changes and will ping once the interactive part is merged and I have updated this PR.

).properties(
title='By Channel'
)

# Sort according to another field
sortfield = base.encode(
alt.X(field='site', type='nominal',
sort=alt.EncodingSortField(field='yield', op='min'))
alt.X('site:N').sort(field='yield', op='max')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't see a change in the sort order in the current docs with min:

image

@joelostblom
Copy link
Contributor Author

@binste I updated the interactive page in the docs now too, so this PR is ready for full review.

@joelostblom joelostblom marked this pull request as ready for review March 27, 2023 21:49
@joelostblom joelostblom merged commit 3850009 into master Mar 29, 2023
@mattijn
Copy link
Contributor

mattijn commented Mar 29, 2023

I've this error/warning while building the docs locally:

C:\Notebooks\mattijn\altair\sphinxext\altairplot.py:251: UserWarning: altair-plot: C:\Notebooks\mattijn\altair\doc\user_guide\marks\errorband.rst:157 Code Execution failed:SyntaxError: invalid syntax (<ast>, line 10)
  warnings.warn(message)

That is around here: https://github.com/altair-viz/altair/blob/master/doc/user_guide/marks/errorbar.rst?plain=1#L157

Not sure why this leads to a syntax error.

You do not have this message?

@joelostblom
Copy link
Contributor Author

Good catch, fix in #3004

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.

3 participants