You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➡️ A readable walkthrough of how to use the package together with some useful examples can be found in [this blog post](https://www.wmccorkindale.com/post/introducing-molplotly) while a runnable notebook can be found in `example.ipynb` :)
12
+
➡️ A readable walkthrough of how to use the package together with some useful examples can be found in [this blog post](https://www.wmccorkindale.com/post/introducing-molplotly) while a runnable notebook can be found in `examples/example.ipynb` :)
a plotly figure object containing datapoints plotted from df
52
+
a plotly figure object containing datapoints plotted from `df`.
52
53
53
54
-`df` : pandas.DataFrame object\
54
-
a pandas dataframe that contains the data plotted in fig
55
+
a pandas dataframe that contains the data plotted in `fig`.
55
56
-`smiles_col` : str, optional\
56
-
name of the column in df containing the smiles plotted in fig (default 'SMILES')
57
+
name of the column in df containing the smiles plotted in `fig` (default 'SMILES').
57
58
-`show_img` : bool, optional\
58
-
whether or not to generate the molecule image in the dash app (default True)
59
+
whether or not to generate the molecule image in the dash app (default True).
60
+
-`svg_size` : float, optional
61
+
the size in pixels of the molecule drawing (default 200).
62
+
-`alpha` : float, optional\
63
+
the transparency of the hoverbox, 0 for full transparency 1 for full opaqueness (default 0.7).
64
+
-`mol_alpha` : float, optional\
65
+
the transparency of the SVG molecule image, 0 for full transparency 1 for full opaqueness (default 0.7).
59
66
-`title_col` : str, optional\
60
-
name of the column in df to be used as the title entry in the hover box (default None)
67
+
name of the column in df to be used as the title entry in the hover box (default None).
61
68
-`show_coords` : bool, optional\
62
-
whether or not to show the coordinates of the data point in the hover box (default True)
69
+
whether or not to show the coordinates of the data point in the hover box (default True).
63
70
-`caption_cols` : list, optional\
64
-
list of column names in df to be included in the hover box (default None)
71
+
list of column names in df to be included in the hover box (default None).
65
72
-`caption_transform` : dict, optional\
66
-
Functions applied to specific items in all cells. The dict must follow a key: function structure where the key must correspond to one of the columns in subset or tooltip. (default {})
73
+
Functions applied to captions for formatting. The dict must follow a key: function structure where the key must correspond to one of the columns in subset or tooltip (default {}).
67
74
-`color_col` : str, optional\
68
-
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None)
75
+
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None).
76
+
-`marker_col` : str, optional\
77
+
name of the column in df that is used to determine the marker shape of the datapoints in df (default None).
69
78
-`wrap` : bool, optional\
70
-
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True)
79
+
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True).
71
80
-`wraplen` : int, optional\
72
-
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20)
81
+
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20).
73
82
-`width` : int, optional\
74
-
the width in pixels of the hover box (default 150)
83
+
the width in pixels of the hover box (default 150).
75
84
-`fontfamily` : str, optional\
76
-
the font family used in the hover box (default 'Arial')
85
+
the font family used in the hover box (default 'Arial').
77
86
-`fontsize` : int, optional\
78
-
the font size used in the hover box - the font of the title line is fontsize+2 (default 12)
87
+
the font size used in the hover box - the font of the title line is fontsize+2 (default 12).
79
88
80
89
#### Output parameters
81
90
82
91
by default a JupyterDash `app` is returned which can be run inline in a jupyter notebook or deployed on a server via `app.run_server()`
83
92
84
93
- The recommended `height` of the app is `50+(height of the plotly figure)`.
85
-
- For the `port` of the app, make sure you don't pick the same `port` as another `molplotly` plot otherwise the tooltips will clash with each other!
94
+
- For the `port` of the app, make sure you don't pick the same `port` as another `molplotly` plot otherwise the tooltips will clash with each other. Also, apparently on windows port numbers below `8700` are used by other processes so for safety processes keep to numbers above that.
86
95
87
96
## 💻 Can I run this in colab?
88
97
89
-
JupyterDash is supposed to have support for Google Colab but at some point that seems to have broken... Keep an eye on the raised issue [here](https://github.com/plotly/jupyter-dash/issues/10)!
98
+
JupyterDash is supposed to have support for Google Colab but at some point that seems to have broken.. Keep an eye on the raised issue [here](https://github.com/plotly/jupyter-dash/issues/10)!
99
+
Update (1st March 2022): The plots seem to be running again but the hoverboxes are not showing so I don't think it has been fully fixed - I will keep an eye on it in the meantime.
90
100
91
101
## 💾 Can I save these plots?
92
102
103
+
An issue/feature request for this has already been raised [here](https://github.com/wjm41/molplotly/issues/4).
104
+
93
105
`moltplotly` works using a Dash app which is non-trivial to export because server side javascript is needed in addition to HTML/CSS styling ([as detailed here](https://stackoverflow.com/questions/60097577/how-to-export-a-plotly-dashboard-app-into-a-html-standalone-file-to-share-with-t))
94
106
95
-
Until I find a way to get around that, the best alternative is exporting the plotly figure without molecules showing :( as detailed in this [page](https://plotly.com/python/interactive-html-export/). If you want to use it in a presentation I'd suggest keeping the figure open in a browser and changing windows to it during your talk!
107
+
Until I find a way to get around that, the best alternative is to either host the plot on an app/server, exporting the plotly figure without molecules showing :( as detailed in this [page](https://plotly.com/python/interactive-html-export/). If you want to use it in a presentation I'd suggest keeping the figure open in a browser and changing windows to it during your talk!
0 commit comments