Hi!
I’m trying to get a square categorical gridplot of piecharts/wedges working. However, I can’t seem to get the scaling in a go.layout.Grid to be square, nor can I get “gridlines”, “axis” ticks or something similar in. This may be stretching the capabilities of go.layout.Grid and go.Pie a little, but perhaps any of you see a solution!
The code:
import plotly.offline as py
import plotly.graph_objs as go
import random
nodes = ["apple", "pear", "pineapple", "grape", "passion fruit"]
ews = ["acidity", "sugar", "texture", "juice"]
rng = range(len(nodes))
edge_weights = [[[random.randint(0,1)*random.randint(0,1)*random.randint(1,100) for ew in ews] for i in rng] for j in rng]
pies = []
for i, source in enumerate(nodes):
for j, target in enumerate(nodes):
pie = go.Pie(labels=ews, values=edge_weights[i][j], text=None, domain=go.pie.Domain(row=i, column=j), textinfo='none', hoverinfo='skip')
pies.append(pie)
grid = go.layout.Grid(rows=len(nodes), columns=len(nodes), pattern="coupled", xgap=0.1, ygap=0.1)
layout = go.Layout(grid=grid, autosize=False)
fig=go.Figure(pies, layout=layout)
py.iplot(fig)
So, I’m trying to get the following things in:
- xaxes scaling w.r.t. yaxes should be 1:1 (e.g. the gaps between piecharts)
- axes labels (like tick marks in a categorical plot)
- grid lines
Any ideas?