I run into trouble trying to add variogram graph from SciKit GStat as a subplot in plotly.
The error is describe as The 'data' property is a tuple of trace instances. I'm not sure if it's some error in make_subplots specs, but I have no idea how to fix it.
The 'data' property is a tuple of trace instances
that may be specified as:
- A list or tuple of trace instances
(e.g. [Scatter(...), Bar(...)])
- A single trace instance
(e.g. Scatter(...), Bar(...), etc.)
- A list or tuple of dicts of string/value properties where:
- The 'type' property specifies the trace type
One of: ['bar', 'barpolar', 'box', 'candlestick',
'carpet', 'choropleth', 'choroplethmapbox',
'cone', 'contour', 'contourcarpet',
'densitymapbox', 'funnel', 'funnelarea',
'heatmap', 'heatmapgl', 'histogram',
'histogram2d', 'histogram2dcontour', 'icicle',
'image', 'indicator', 'isosurface', 'mesh3d',
'ohlc', 'parcats', 'parcoords', 'pie',
'pointcloud', 'sankey', 'scatter',
'scatter3d', 'scattercarpet', 'scattergeo',
'scattergl', 'scattermapbox', 'scatterpolar',
'scatterpolargl', 'scattersmith',
'scatterternary', 'splom', 'streamtube',
'sunburst', 'surface', 'table', 'treemap',
'violin', 'volume', 'waterfall']
- All remaining properties are passed to the constructor of
the specified trace type
(e.g. [{'type': 'scatter', ...}, {'type': 'bar, ...}])
Example script:
import pandas as pd
import skgstat as skg
from skgstat.plotting import backend
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=1,cols=2,
specs=[[{'type':'scene'},{'type':'xy'}]])
df = pd.DataFrame({'X':[350539.3, 350536.1, 350533.2, 350530.4, 350527.6],
'Y':[4212487.5, 4212483.2, 4212478.8, 4212474.1, 4212469.5],
'Z':[1765.52, 1765.54, 1765.54, 1765.47, 1765.42],
'R':[12.95, 13.42, 14.48, 14.58, 14.16]})
trace1 = go.Scatter3d(x=df.X.values, y=df.Y.values, z=df.Z.values)
backend('plotly')
V1 = skg.Variogram(df[["X", "Y", "Z"]].values, df.R.values,
estimator='matheron', n_lags=10, model='gaussian')
trace2 = V1.plot()
fig.add_trace(trace1,1,1)
fig.add_trace(trace2,1,2)
fig.show()
I'm able to open both maps by run
fig.add_trace(trace1,1,1)
fig.show()
and
trace2.show()
but
fig.add_trace(trace2,1,2)
fig.show()
will fail