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

Clarify data types accepted by Points #4430

Merged
merged 2 commits into from
Nov 20, 2020
Merged

Clarify data types accepted by Points #4430

merged 2 commits into from
Nov 20, 2020

Conversation

jbednar
Copy link
Member

@jbednar jbednar commented May 20, 2020

This may be a local fix to a global problem, but it's difficult to tell which types of data are accepted by HoloViews elements, so I thought it would be useful to illustrate various accepted formats for at least one basic Element type, i.e. Points. The previous example uses np.random to make a random multidimensional array, which is convenient but is quite opaque -- what does each column and row in that array represent? How would I format my own data to use with this Element?

I've kept the existing examples mostly as-is, but added a new bit explicitly listing the x, y, size, and color variables and showing how to supply those to Points:

image

Issues:

  • Is this the right place to put this information? If not, where, and we'll need to link to it from here.
  • Is this a relatively complete list of the data formats that are reasonable to provide? It doesn't need to be exhaustive, but should include the most typical or common ways that we expect users to provide data.
  • Pending approval of this change, I have not updated the Matplotlib and Plotly notebooks in the same way yet.

Also note that I updated the colormap, because the previous colormap ("fire") was mapping the brightest values to white (the background color of the page), making them disappear:

image

as-is (apart from updating the colormap so

@jbednar
Copy link
Member Author

jbednar commented May 20, 2020

I'm also wondering why I had to specify , vdims=['z', 'size'] for the dictionary but not for the dataframe. Aren't the dimension names available in the same way already in both cases? For whatever reason, the dataframe works fine without the explicit vdims but the dictionary does not:

WARNING:param.PointPlot03040: Specified size dim transform dim('size')*20 
could not be applied, as not all dimensions could be resolved.

@philippjfr
Copy link
Member

Aren't the dimension names available in the same way already in both cases?

DataFrames have column order, dictionaries do not (until Python 3.6).

@jbednar
Copy link
Member Author

jbednar commented May 20, 2020

How does ordering affect finding size by name?

@philippjfr
Copy link
Member

The lack of ordering means we cannot automatically deduce a consistent dimension order so you have to declare dimensions explicitly.

@jbednar jbednar added the type: docs Related to the documentation and examples label Nov 20, 2020
@jbednar jbednar merged commit 95578d4 into master Nov 20, 2020
@jbednar jbednar deleted the pts branch November 20, 2020 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Related to the documentation and examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants