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

Is it possible to create categorical scatter plots? #3266

Open
dpantel opened this issue Jun 25, 2023 · 4 comments
Open

Is it possible to create categorical scatter plots? #3266

dpantel opened this issue Jun 25, 2023 · 4 comments
Labels

Comments

@dpantel
Copy link

dpantel commented Jun 25, 2023

Description

I am looking to create a categorical scatter plot, where one of the axes contains categories, and the other is numeric. I want to be able to plot multiple sets of data via a category-number coordinate.

Here is an example of a type of plot I am attempting to create.

Is this possible with Billboard?

@watnab
Copy link

watnab commented Jun 27, 2023

via a category-number coordinate.

Can the category be numeric?

date x tick.format
2023/06/01 0.90
2023/06/08 0.95
2023/06/15 1.00 Thur
2023/06/22 1.05
2023/06/29 1.10
2023/06/02 1.90
... ... ...
2023/06/16 2.00 Fri
... ... ...

@dpantel
Copy link
Author

dpantel commented Jun 28, 2023

@watnab Yes that might work. I was trying to have the X values as strings, which worked for one data set but not multiple. Using numeric X coordinates and relabeling them seems to be working.

One of the issues in this approach is that if the particular value (X=1 in your example) is not present in the set, then there is no label.

@watnab
Copy link

watnab commented Jun 29, 2023

Using numeric X coordinates and relabeling them
if the particular value (X=1 in your example) is not present in the set

var chart = bb.generate({
  data: {
    xs: {data: "data_x"},
    columns: [
	["data_x", 0.95, 1.05, 2.05],
	["data", 10, 5, 7]
    ],
    type: "scatter",
  },
  axis: {
    x: {
      min: 0,
      max: 8,
      tick: {
        values: [1, 2, 3, 4, 5, 6, 7],
        format: function (day) { return "MTWtFSs"[day - 1]; }
      }
    }
  }
});

@dpantel
Copy link
Author

dpantel commented Jun 29, 2023

That actually works very well. Thank you

@netil netil added the question label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants