-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] plot metrics: initital #3569
Conversation
dvc/repo/init.py
Outdated
@@ -100,6 +101,8 @@ def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False): | |||
with config.edit() as conf: | |||
conf["core"]["no_scm"] = True | |||
|
|||
init_plot_templates(dvc_dir) |
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.
What if this is a pre-existing repo and there is no plot template?
dvc/command/plot.py
Outdated
|
||
class CmdPlot(CmdBase): | ||
def run(self): | ||
self.repo.plot(self.args.targets) |
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.
Nitpick: It could raise an exception from somewhere, right? Let's wrap it into try&except, same as we do in other places.
|
||
|
||
def init_plot_templates(dvc_dir): | ||
|
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.
probably a leftover
dvc/plot.py
Outdated
def init_plot_templates(dvc_dir): | ||
|
||
templates = [DefaultTemplate] | ||
[t(dvc_dir).dump() for t in templates] |
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.
is there a reason to create this list?
@pared This looks great! π Trying it out, I also see that the default resolution is quite crusty, is there a setting for that in the template? Or is it something on my end? Could it show vector graphics by any chance? |
@efiop [EDIT] |
Yes, take note that in the top right corner, there is a button with saving options, you can obtain SVG there. |
I think we may want to use vega's responsive sizing and just make our default template scale automatically to the user's browser window by setting a percentage-based height/width One other thing I noticed is that when you export to SVG, it generates a graphic with a fixed width/height in pixels so that the exported graphic doesn't actually scale. This always seemed to be the case regardless of whether or not the vega json was using default/fixed/responsive sizing. This can also be fixed by manually editing the SVG to use a percentage-based height/width but I'm wondering if there's a way to make vega do that automatically? |
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 so far, I think we can make the default vega templates a bit nicer though (see my other comment)
@pmrowla |
closing in favor of #3577 |
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
β I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. π
Related to #3409
As of today: only json metrics structured as vega-compliant data accepted (basically list of
{"x":, "y":}
), due to CORS related issues.Vega has capabilities of loading the data (and transforming) by itself, but that would require us to set up local server sharing theese files, which seems like overkill, at least in initial version of visualization. So for now we are stuck with injecting display code directly into page code.