WarrenWeckesser / vfgen-doc

Source for the VFGEN documentation.
0 stars 0 forks source link

Use plotly for generated plots? #2

Open WarrenWeckesser opened 2 months ago

WarrenWeckesser commented 2 months ago

Idea: replace SVG plots with plotly plots.

For example, in menu_boostodeint.html, replace the img element with

<div id="tester" style="width:600px;height:350px;"></div>

<script type="module">
import {boost_odeint_pendulum_plot_data} from './example_boostodeint/pendulum_plot_data.js';
var TESTER = document.getElementById('tester');
var layout = {
    title:'Pendulum',
    xaxis: {
        title: {
            text: 't',
            font: {
                family: 'Courier New, monospace',
                size: 18
            }
        },
    },
};
Plotly.newPlot( TESTER, boost_odeint_pendulum_plot_data, layout);
</script>

In example_boostodeint/, add the generated file pendulum_plot_data.js

const theta = {
  x: [0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09,
      0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19,
      0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29,
      <snip>
      9.9, 9.91, 9.92, 9.93, 9.94, 9.95, 9.96, 9.97, 9.98, 9.99,
      10.0],
  y: [3.13159, 3.13159, 3.13157, 3.13155, 3.13151, 3.13147, 3.13142, 3.13135, 3.13128, 3.13119,
      3.1311, 3.13099, 3.13088, 3.13075, 3.13062, 3.13047, 3.13031, 3.13014, 3.12996, 3.12977,
      <snip>
      2.79612, 2.78519, 2.77392, 2.76229, 2.7503, 2.73794, 2.72519, 2.71205, 2.6985, 2.68452, 2.67012,
      2.65526],
  name: 'θ'
};
const v = {
  x: [0.0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09,
      0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0. 9.98, 9.99, 10.0,
      <snip>
     ] 
  y: [0.0, -0.000981144, -0.00196325, -0.00294728, -0.00393421, -0.00492499, -0.00592061,
     <snip>
     ],
  name: 'v'
};
const boost_odeint_pendulum_plot_data = [theta, v];
export {boost_odeint_pendulum_plot_data}
WarrenWeckesser commented 2 months ago

Updated so far: adolc, cvode7, dde_solver, delay2ode, gsl, lsoda, radau5.