In [1]:
import pandas as pd
In [9]:
df = pd.read_hdf('bigDataFrame.H5')
df.head()
Out[9]:
In [4]:
import plotly.offline as pyoff
import plotly.plotly as pyol
import plotly.tools as tls
In [11]:
# df_s=df.loc[df['zeta']==list(set(df['zeta']))[0]].sample(frac=0.1)
df_s=df.sample(frac=0.1)
x='H2O'
y='CO2'
z='N2'
fig_db = {
'data': [
{'x': df_s[x],
'y': df_s[y],
'z': df_s[z],
'type':'scatter3d',
'mode': 'markers',
'marker':{
'size':1
}
}
],
'layout': {
'scene':{
'xaxis':{'title':x},
'yaxis': {'title': y},
'zaxis': {'title': z}
}
}
}
pyoff.iplot(fig_db, filename='multiple-scatter')
In [63]:
z_level=list(set(df['gridZ']))[1]
df_slice=df.loc[df['gridZ']==z_level].sample(frac=1)
df_s=df.sample(frac=1)
x='CO2'
y='H2O'
z='H'
fig_db = {
'data': [
{
'name':'all data',
'x': df_s[x],
'y': df_s[y],
'z': df_s[z],
'type':'scatter3d',
'mode': 'markers',
'marker':{
'size':1
}
},
{
'name':'slice z ='+str(z_level),
'x': df_slice[x],
'y': df_slice[y],
'z': df_slice[z],
'type':'scatter3d',
'mode': 'markers',
'marker':{
'size':1
}
}
],
'layout': {
'scene':{
'xaxis':{'title':x},
'yaxis': {'title': y},
'zaxis': {'title': z}
}
}
}
pyoff.iplot(fig_db, filename='multiple-scatter')
In [57]:
df_slice=df_slice.sort_values(['gridCO2','gridH2O'])
surface_z=df_slice['H'].values.reshape(50,50)
df_slice.head()
Out[57]:
In [59]:
import plotly.graph_objs as go
data = [
go.Surface(
z=surface_z,
contours=go.surface.Contours(
z=go.surface.contours.Z(
show=True,
usecolormap=True,
highlightcolor="#42f462",
project=dict(z=True)
)
)
)
]
layout = go.Layout(
title='surface plot',
autosize=False,
scene=dict(
camera=dict(eye=dict(x=1.87, y=0.88, z=-0.64)),
xaxis=dict(title='CO2'),
yaxis=dict(title='H2O')
),
width=500,
height=500,
margin=dict(
l=65,
r=50,
b=65,
t=90
)
)
fig = go.Figure(data=data, layout=layout)
pyoff.iplot(fig, filename='elevations-3d-surface-contours')
In [ ]: