Commit 40650f20d7dedad02fc01bb39966cb01f045f91a
1 parent
d87f627177
Exists in
master
Preparing interactive scatter plot in order to generate cool visualizations.
Showing 1 changed file with 22 additions and 1 deletions Side-by-side Diff
volia/plot.py
| ... | ... | @@ -46,7 +46,19 @@ |
| 46 | 46 | print("Your plot is saved well (no check of this affirmation)") |
| 47 | 47 | |
| 48 | 48 | |
| 49 | +def interactive_scatter_plot(features: str, labels: str, outdir: str): | |
| 50 | + """Generate an interactive scatter plot in 3D. Mainly used for | |
| 51 | + data visualisation processed with tsne or algorithm like | |
| 52 | + this later. This visualization is generated in Web files. | |
| 49 | 53 | |
| 54 | + Args: | |
| 55 | + features (str): Features file in 2d or 3d | |
| 56 | + labels (str): Labels file | |
| 57 | + outdir (str) : output directory where Web files are saved | |
| 58 | + """ | |
| 59 | + pass | |
| 60 | + | |
| 61 | + | |
| 50 | 62 | if __name__ == '__main__': |
| 51 | 63 | |
| 52 | 64 | # Main parser |
| 53 | 65 | |
| ... | ... | @@ -60,12 +72,21 @@ |
| 60 | 72 | parser_scatter.add_argument("--outfile", default="./out.pdf", type=str, help="Specify the output file (better in pdf)") |
| 61 | 73 | parser_scatter.set_defaults(which="scatter") |
| 62 | 74 | |
| 75 | + | |
| 76 | + # interactive scatter | |
| 77 | + parser_interactive_scatter = subparsers.add_parser("interactive_scatter") | |
| 78 | + parser_interactive_scatter.add_argument("features", type=str, help="features files with only 3D will be converted into csv") | |
| 79 | + parser_scatter.add_argument("--labels", default=None, type=str, help="Specify the labels of each utterance/element") | |
| 80 | + parser_scatter.add_argument("--outdir", default=".out", type=str, help="output directoy where static web and data files are saved.") | |
| 81 | + parser_scatter.set_defaults(which="interactive_scatter") | |
| 82 | + | |
| 63 | 83 | # Parse |
| 64 | 84 | args = parser.parse_args() |
| 65 | 85 | |
| 66 | 86 | # Run commands |
| 67 | 87 | runner = SubCommandRunner({ |
| 68 | - "scatter" : scatter_plot | |
| 88 | + "scatter" : scatter_plot, | |
| 89 | + "interactive_scatter" : interactive_scatter_plot | |
| 69 | 90 | }) |
| 70 | 91 | |
| 71 | 92 | runner.run(args.which, args.__dict__, remove="which") |