Skip to content

Commit

Permalink
[Tutorials] Enable plotly support
Browse files Browse the repository at this point in the history
The botorch tutorials are currently configured to output plots as images but our conversion script supports plotly. Let's enable plotly support to keep the conversion consistent between the botorch and ax repos since they use the same script.

We can update the tutorials to output plotly in the future.
  • Loading branch information
CristianLara committed Dec 17, 2024
1 parent 659379c commit 48f3757
Show file tree
Hide file tree
Showing 3 changed files with 1,764 additions and 58 deletions.
2 changes: 2 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
"@docusaurus/preset-classic": "^3.6.3",
"bl": "^6.0.0",
"clsx": "^1.1.1",
"plotly.js": "^2.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-plotly.js": "^2.5.1",
"rehype-katex": "7",
"remark-math": "6"
}
Expand Down
35 changes: 17 additions & 18 deletions website/src/components/Plotting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@

import React from 'react';
import Loadable from 'react-loadable';
import BrowserOnly from '@docusaurus/BrowserOnly';

// const Plotly = Loadable({
// loader: () => import(`react-plotly.js`),
// loading: ({timedOut}) =>
// timedOut ? (
// <blockquote>Error: Loading Plotly timed out.</blockquote>
// ) : (
// <div>loading...</div>
// ),
// timeout: 10000,
// });
const Plotly = Loadable({
loader: () => import(`react-plotly.js`),
loading: ({timedOut}) =>
timedOut ? (
<blockquote>Error: Loading Plotly timed out.</blockquote>
) : (
<div>loading...</div>
),
timeout: 10000,
});

// export const PlotlyFigure = React.memo(({data}) => {
// return (
// <div className="plotly-figure" style={{"overflow-x": "auto"}}>
// <Plotly data={data['data']} layout={data['layout']} />
// </div>
// );
// });
export const PlotlyFigure = React.memo(({data}) => {
return (
<div className="plotly-figure" style={{"overflow-x": "auto"}}>
<Plotly data={data['data']} layout={data['layout']} />
</div>
);
});
Loading

0 comments on commit 48f3757

Please sign in to comment.