In [163]:
from scipy import io
import pandas as pd
import plotly
In [ ]:
p = plotly.plotly("VitorEmmanuel", "xxxx")
In [165]:
mat_data = io.loadmat('/home/vitor/Dropbox/Pos-Graduacao/Codigo/Datasets/FDIAC/Dados_Sist01_train.mat')
Dados colocados em um DataFrame do Pandas para fácil localização
In [166]:
dados = DataFrame(mat_data['UsedData'], columns = ['Temperature', 'Pattern', 'Class'])
temp = DataFrame(mat_data['temp'], columns = ['Temperature', 'Pattern', 'Class'])
Dadosv7 = DataFrame(mat_data['Dadosv7'], columns = ['Temperature', 'Pattern', 'Class'])
%%Dados sem uso do Pandas. Os dados ficam em um array do Numpy
In [167]:
padroes = mat_data['Padrao']
In [168]:
dr = pd.date_range('2008-01-01', periods=dados['Temperature'][dados['Pattern']==0].size, freq='30s')
Normal = pd.Series(dados['Temperature'][dados['Pattern']==0].values, index=dr)
In [169]:
graph_data = []
graph_data.append(
{
'name': 'Normal Pattern', # the "name" of this series is the Continent
'x': Normal.index,
'y': Normal.values,
'type' : 'scatter',
'mode': 'lines+markers',
'line' : {'color':'darkgray', 'width':1, 'dash':'dot'},
'marker': {'opacity': 1.0, 'symbol': 'cross', "size": 2, "color": 'red', "line":{"color":"", "width":0},}})
In [177]:
xaxesstyle = {
"autotick" : True,
"showgrid" : True,
"showline" : True,
"showticklabels" : True,
"tickangle" : 45,
"showexponent" : "All",
"exponentformat" : "e",
"zeroline" : True,
"ticks" : "inside",
'title': 'Time (hours)'
}
yaxesstyle = {
"autotick" : True,
"showgrid" : True,
"showline" : True,
"showticklabels" : True,
"exponentformat" : "e",
"zeroline" : True,
"ticks" : "outside",
'title': 'Temperature (C)'
}
layout = {
'xaxis': xaxesstyle,
'yaxis': xaxesstyle,
#'title': 'Normal Pattern',
'showlegend': False
}
In [178]:
p.iplot(graph_data, layout=layout, width=1000, height=650, filename='FDIAC/normal_pattern', fileopt='overwrite')
Out[178]:
In [220]:
fig1 = figure(num=None, figsize=(20, 10), dpi=500, facecolor='w', edgecolor='k', frameon=True)
ax = axes()
fig1.patch.set_alpha(0) # Sets the figure transparent
ax.patch.set_alpha(0) # Sets the axis transparent
ax.set_aspect('auto')
plot(Normal.index, Normal.values, linestyle='--', marker='o', markerfacecolor='r', markeredgecolor='r', color='gray', markersize=2)
xlabel('Time (hours)')
ylabel('Temperature (C)')
savefig('Normal_Pattern.eps', format='eps', dpi=500)
savefig('Normal_Pattern.png', format='png', dpi=500)
[TODO]
In [ ]: