-
Notifications
You must be signed in to change notification settings - Fork 23
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
Split distribution chart in 2. Fix colours #1388
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Ok, fixed the duplication. A comment is that I did this refactor mainly by allowing people to create a plot object that looks like the default plot, and then getting DistributionChart to call MultiDistributionChart with this plot object. This means that it exposes Soon (after the typescript refactor) I'll add back |
I've just realised this has a regression for summary tables! I'll fix that now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional Stdev header is a problem, e.g. https://squiggle-website-git-split-distri-178559-quantified-uncertainty.vercel.app/playground#code=eNplyr0KwjAQAOBXOW5SqEILLhkEserklNE6RHPFQNKT9KKUknf3BxTB9eMbsb%2FwXacQTBxQSUxUvGljnXD8iKXWJC9rtoQKR%2Bt6ie6UxHHXKziMnQmkoMGdu1HtIp3FDw0W8BsVlCAMVS7g%2B1f77X%2BbLF6vrKazpTbh6kmTzNvIoX62fMxNh%2FkBzb9Agw%3D%3D
I like everything else about this!
const r = toJsonRecord(record); | ||
console.log(r); | ||
const plotRecord = schema.validateSync(r); | ||
console.log(plotRecord); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug logging.
), | ||
showLegend: yup.boolean().default(true), | ||
colorScheme: yup.string().default("category10"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much do we care about backward compatibility on this?
I expect we'll drop Vega at some point in favor of d3 or something else, and supporting all color schemes would be a lot of work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upd: I wrote this comment before I saw your comment above that this is temporary.
.shape({ | ||
name: yup.string().required(), | ||
distribution: yup.mixed().required(), | ||
opacity: yup.number().default(0.3), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this comment is not very important and can be ignored; I understand that this plots-as-squiggle-records syntax is temporary and we don't expect to announce it too widely)
I think in cases like this we should restrict the API more, unless there's a clear need for flexibility. How about transparent: yup.boolean()
? Or maybe we don't have to expose the this field on yup schema at all?
Any extra field like this:
- gives users more flexibility
- but make representation changes for us more costly (if we ever decide to render plots differently, but we gave users control over tiny details of Vega, e.g. colors and line thickness and so on, we won't be sure that the new representation is compatible with existing heavily customized plots)
- sometimes it can put more burden on users to pick the good-looking defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upd: I wrote this comment before I saw your comment above that this is temporary.
The error that shows is now a bit verbose: But otherwise, it's fine. It does incentivise me to fix #530 . |
I replaced it with XIcon wrapped in tooltip. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
found a weird inconsistency here @Hazelfire @berekuk neither of the above approaches work in playground. they do work for me in vscode. on the other hand, the old Plot.dists approach does work in playground, but does not work for me in vscode! my squiggle vscode version is v0.5.1. i see that theres a more recent version, but (1) it doesn't show up for me inside vscode and (2), more importantly, if playground is more up-to-date than my local version, i should observe the opposite compatibility pattern. EDIT: i've noticed that the new approaches don't work in vscode for |
@joel-becker Right, we've added With VS Code, the problem is that the release for 0.6.0 is still marked as pre-release, I think because when I did 0.6.0 release, VS Code marketplace was down and wouldn't accept the new version. We'll do 0.6.1 soon-ish, but in the meantime you can switch to pre-release through VS Code interface: (0.5.99 extension version matches 0.6.0-alpha.1 squiggle release, which is identical to final 0.6.0 release) I'm not sure why plotting samplesets won't work, but it seems to work fine now with Plot.dists. |
thank you very much @berekuk ! will try this out later. until then could i bug @Hazelfire for how he converts distributions to lists of samples (to be plotted as distributions, as here)? is there some way to export samples -- for use in squiggle, or elsewhere? this feature would be immensely helpful to me. (getting plots i want much easier outside squiggle.) |
Currently, if you are in a JS environment, you can look at the resulting distributions and pull those samples out into JS land to plot differently. My solution is hacky, and was built because Squiggle doesn't yet have a standard way of importing/exporting/serialising distributions. I'm not sure what environment you are using, but you may want a VS code action that can export distributions. Exporting and importing distributions from different projects was a project that I was going to look into, and this is the second reminder I've gotten that I should probably look into it again. Serializing Squiggle objects into a standard format seems like it would be useful in a couple of contexts, such as caching. Could be worth putting on the todo list sooner rather than later. Feel free to book a call with me if you want to chat about it further. |
thanks @Hazelfire :) booking a call in case it will be helpful for (1) me to probe the JS environment thingy and/or (2) you to use me as focus group for feature prioritization. if neither are true, feel free to cancel. fwiw, i think for private benefits alone i would pay $500 for this rn. more if thinking about it as contribution to public good, or if using employer money. off top of my head, the next highest willingness to pay for a squiggle feature is within-squiggle saving to enable more costly pipelines at <$100. |
@joel-becker ( You can also use |
@berekuk thank you! anything that lets me save samples in such a way that i could import into R/python would be super helpful.
|
Since inspect requires you to open dev tools, which feels hacky, initially I thought of something like this: normal(0,1) -> SampleSet.fromDist -> SampleSet.toList. But the output format is not right. So there are some possible improvements:
You won't need to parse it. I meant the The API is:
|
thank you very much again @berekuk -- this is super helpful! i'm not understanding this piece:
I start with the script + preview. I open up devtools, go to console tab. there are far fewer than 1k samples listed and, besides, I'm not sure how to "copy it from there in the standard |
In your example, In my version, that anonymous
Or, simplifying further:
(the "x" part is optional) |
aha! got it! thank you once again vyacheslav! |
This PR creates a separate class for Multi charts and normal charts. This allows me to differentiate between plot objects with one element and simple distributions, which I think should be rendered differently. Particularly as it comes to colour schemes.
I also fix the colours up a bit for multiplots, they look like this currently:
This paves the way to having summary tables for multiplot distributions.
This currently has a lot of duplication, I'll look to remove as much duplication as possible before saying this is ready for review.