Exemplo n.º 1
0
 def plot(self):
     if self.backend == "mpl":
         plt.show()
     elif self.backend == "ipt":
         iplot_mpl(self.fig)
     else:
         plot_mpl(self.fig)
def plot(herd, title):
    colors = ['r','g','b']
    fig, ax = plt.subplots()
    plt.title(title)
    for num, group in enumerate(herd.groups):
        x = [cow.energy_requirement for cow in group]
        y = [cow.protein_requirement for cow in group]
        ax.scatter(x, y, color=colors[num%3])
    py.plot_mpl(fig, filename=title+".html", image_filename=title)
Exemplo n.º 3
0
def plot(herd, title):
    colors = ['r', 'g', 'b']
    fig, ax = plt.subplots()
    plt.title(title)
    for num, group in enumerate(herd.groups):
        x = [cow.energy_requirement for cow in group]
        y = [cow.protein_requirement for cow in group]
        ax.scatter(x, y, color=colors[num % 3])
    py.plot_mpl(fig, filename=title + ".html", image_filename=title)
Exemplo n.º 4
0
    def get_plot_path_matplotlib_plotly(self, file_name='matplotlib_plotly.html'):
        path_plotly = self.path_dir_plotly_html + os.sep + file_name

        N = 50
        x = np.random.rand(N)
        y = np.random.rand(N)
        colors = np.random.rand(N)
        area = np.pi * (15 * np.random.rand(N)) ** 2  # 0 to 15 point radii
        scatter_mpl_fig = plt.figure()
        plt.scatter(x, y, s=area, c=colors, alpha=0.5)

        pyof.plot_mpl(scatter_mpl_fig, filename=path_plotly, resize=True, auto_open=False)
        return path_plotly
                                trace=True,
                                error_action='ignore',
                                suppress_warnings=True,
                                stepwise=True)
    print(stepwise_model.aic())

    stepwise_model.fit(train)

    future_forecast = stepwise_model.predict(n_periods=test.shape[0])
    print(future_forecast)
    future_forecast = pd.DataFrame(future_forecast, index=test.index)
    if i == 0:
        plt.title('EC2-Instances(USD)')
    if i == 1:
        plt.title('EC2-Andere(USD)')
    if i == 2:
        plt.title('EC2-ELB(USD)')
    if i == 3:
        plt.title('S3(USD)')
    if i == 4:
        plt.title('Gesamtkosten (USD)')

    plt.plot(future_forecast, label='Prediction')
    plt.plot(test, label='True')
    plt.legend()
    plt.show()

    result = seasonal_decompose(data, model='multiplicative', freq=10)
    fig = result.plot()
    plot_mpl(fig)
Exemplo n.º 6
0
import csv
import matplotlib.pyplot as plt
import plotly
plotly.offline.init_notebook_mode(connected=True)
import plotly.offline as py
import numpy as np

# Learn about API authentication here: https://plot.ly/python/getting-started
# Find your api_key here: https://plot.ly/settings/api

results = []
with open("result2.csv") as csvfile:
    reader = csv.reader(
        csvfile, quoting=csv.QUOTE_NONNUMERIC)  # change contents to floats
    for row in reader:  # each row is a list
        results.append(row)

x = results[0]
y = results[1]

fig, ax = plt.subplots()
ax.scatter(x, y)

plot_url = py.plot_mpl(fig, filename="mpl-scatter")