diff --git a/easydiffraction/Job.py b/easydiffraction/Job.py index ab924b20..1e43cae6 100644 --- a/easydiffraction/Job.py +++ b/easydiffraction/Job.py @@ -652,7 +652,7 @@ def print_data(self): print('Measured sy: ', self.experiment.e.data) print('Calculated y:', self.calculate_profile()) - def show_experiment_chart(self): + def show_experiment_chart(self, show_legend=True): ''' Show the experiment chart. ''' @@ -723,10 +723,11 @@ def show_experiment_chart(self): fig.update_xaxes(showline=True, mirror=True, zeroline=False) fig.update_yaxes(showline=True, mirror=True, zeroline=False) + fig.update_layout(showlegend=show_legend) fig.show() - def show_analysis_chart(self): + def show_analysis_chart(self, show_legend=True): ''' Show the analysis chart. ''' @@ -889,6 +890,9 @@ def show_analysis_chart(self): ) fig = go.Figure(data=data, layout=layout) + + fig.update_layout(showlegend=show_legend) + fig.show() def is_notebook(self): diff --git a/examples/Fitting_PD-NEUT-TOF_Si-SEPD.ipynb b/examples/Fitting_PD-NEUT-TOF_Si-SEPD.ipynb index 333ec3ab..ee96d83c 100644 --- a/examples/Fitting_PD-NEUT-TOF_Si-SEPD.ipynb +++ b/examples/Fitting_PD-NEUT-TOF_Si-SEPD.ipynb @@ -38,8 +38,8 @@ "colab" ], "ExecuteTime": { - "end_time": "2024-10-28T10:51:45.789591Z", - "start_time": "2024-10-28T10:51:45.772342Z" + "end_time": "2024-10-28T12:19:40.458783Z", + "start_time": "2024-10-28T12:19:40.437958Z" } }, "source": [ @@ -70,8 +70,8 @@ "id": "33934041eaae166f", "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.668504Z", - "start_time": "2024-10-28T10:51:45.791532Z" + "end_time": "2024-10-28T12:19:43.188280Z", + "start_time": "2024-10-28T12:19:40.461527Z" } }, "source": "import easydiffraction as ed", @@ -97,8 +97,8 @@ "id": "180e216d55b3f144", "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.726207Z", - "start_time": "2024-10-28T10:51:48.710891Z" + "end_time": "2024-10-28T12:19:43.244862Z", + "start_time": "2024-10-28T12:19:43.230401Z" } }, "source": "job = ed.Job(type='tof')", @@ -122,8 +122,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.870944Z", - "start_time": "2024-10-28T10:51:48.861677Z" + "end_time": "2024-10-28T12:19:43.383563Z", + "start_time": "2024-10-28T12:19:43.374258Z" } }, "cell_type": "code", @@ -141,8 +141,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.893646Z", - "start_time": "2024-10-28T10:51:48.875068Z" + "end_time": "2024-10-28T12:19:43.405686Z", + "start_time": "2024-10-28T12:19:43.387785Z" } }, "cell_type": "code", @@ -160,8 +160,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.900727Z", - "start_time": "2024-10-28T10:51:48.898600Z" + "end_time": "2024-10-28T12:19:43.412159Z", + "start_time": "2024-10-28T12:19:43.409703Z" } }, "cell_type": "code", @@ -179,8 +179,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:48.923503Z", - "start_time": "2024-10-28T10:51:48.908231Z" + "end_time": "2024-10-28T12:19:43.431852Z", + "start_time": "2024-10-28T12:19:43.416142Z" } }, "cell_type": "code", @@ -206,8 +206,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:49.200949Z", - "start_time": "2024-10-28T10:51:48.929994Z" + "end_time": "2024-10-28T12:19:43.710146Z", + "start_time": "2024-10-28T12:19:43.443175Z" } }, "cell_type": "code", @@ -242,8 +242,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:49.209206Z", - "start_time": "2024-10-28T10:51:49.205393Z" + "end_time": "2024-10-28T12:19:43.722540Z", + "start_time": "2024-10-28T12:19:43.718803Z" } }, "cell_type": "code", @@ -293,18 +293,18 @@ "id": "238c54cda578c7e7", "metadata": { "ExecuteTime": { - "end_time": "2024-10-28T10:51:49.217913Z", - "start_time": "2024-10-28T10:51:49.213467Z" + "end_time": "2024-10-28T12:19:43.752710Z", + "start_time": "2024-10-28T12:19:43.747641Z" } }, "source": "job.show_crystal_structure(id='si')", "outputs": [ { "data": { - "application/3dmoljs_load.v0": "
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
+ "
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol