コード例 #1
0
    def plot_parameters_respect_to_time_hawkes(self):
        # I m printing the evolution of the parameters there.
        aplot = APlot(how=(1, self.M))
        tt = np.linspace(0, 1, 1000)
        my_colors = plt.cm.rainbow(np.linspace(0, 1, 2 * self.M))
        for i_dim in range(self.M):
            xx_nu = [self.NU[i_dim](t, 1, 0) for t in tt]
            aplot.uni_plot(nb_ax=i_dim,
                           yy=xx_nu,
                           xx=tt,
                           dict_plot_param={
                               "label": f"nu, {i_dim}",
                               "color": "blue",
                               "markersize": 0,
                               "linewidth": 2
                           },
                           tight=False)
            color = iter(my_colors)
            for j_dim in range(self.M):
                c1 = next(color)
                c2 = next(color)
                xx_alpha = [self.ALPHA[i_dim][j_dim](t, 1, 0) for t in tt]
                xx_beta = [self.BETA[i_dim][j_dim](t, 1, 0) for t in tt]
                aplot.uni_plot(nb_ax=i_dim,
                               yy=xx_alpha,
                               xx=tt,
                               dict_plot_param={
                                   "label": f"alpha, {i_dim},{j_dim}.",
                                   "color": c1,
                                   "markersize": 0,
                                   "linewidth": 2
                               },
                               tight=False)
                aplot.uni_plot(nb_ax=i_dim,
                               yy=xx_beta,
                               xx=tt,
                               dict_plot_param={
                                   "label": f"beta, {i_dim},{j_dim}.",
                                   "color": c2,
                                   "markersize": 0,
                                   "linewidth": 2
                               },
                               tight=False)

                aplot.set_dict_fig(
                    i_dim, {
                        'title':
                        "Evolution of the parameters, time in % of total; dimension : {}"
                        .format(i_dim),
                        'xlabel':
                        '',
                        'ylabel':
                        ''
                    })
            aplot.show_legend(i_dim)
コード例 #2
0
    def test_show_legend_for_two_axis(self):
        yy = np.abs(np.cos(self.xx)) + 1
        # second, try the same as before where the second axis is also setting another characteristic.

        aplot = APlot()
        dict_plot1 = {'title': 'my title1'}
        dict_plot2 = {'title': 'my title2'}

        aplot.uni_plot(0, self.xx, yy, dict_ax=dict_plot1)
        aplot.uni_plot_ax_bis(0,
                              self.xx,
                              3 * np.sin(self.xx) + 1,
                              dict_ax=dict_plot2)
        aplot.show_legend()
        self.image_name = "image_legend_two_axis"
        self.check_plot()
コード例 #3
0
                            xx=val_density[::100],
                            yy=values_density_of_SVI1[::100],
                            dict_plot_param={
                                "color": "red",
                                "label": "Density 1"
                            })
    densities_plot.uni_plot(nb_ax=0,
                            xx=val_density[::100],
                            yy=values_density_of_SVI2[::100],
                            dict_plot_param={"label": "Density 2"},
                            dict_ax={
                                "title": "Densities",
                                "xlabel": "Log Moneyness",
                                "ylabel": "PDF"
                            })
    densities_plot.show_legend()

    true_vs_computed_TIV = APlot(how=(1, 1))
    true_vs_computed_TIV.uni_plot(nb_ax=0,
                                  xx=log_moneyness,
                                  yy=true_TIV1,
                                  dict_plot_param={
                                      "label": "1 direct",
                                      "color": "green",
                                      "linestyle": "--",
                                      "linewidth": 3
                                  })
    true_vs_computed_TIV.uni_plot(nb_ax=0,
                                  xx=log_moneyness,
                                  yy=true_TIV2,
                                  dict_plot_param={