Hi, I have a programm in Python which I want to plot. However when I export the csv file and then try to plot from there I have an empty plot. My program is like that:
stations = [1,2]
C = 200
tasks = ['w01','w02','w03']
durations = {(1,'BTC1','w01'):150, (1,'BTC1','w02'):115, (1,'BTC1','w03'):135,
(1,'BOC1','w01'):150, (1,'BOC1','w02'):115, (1,'BOC1','w03'):135,
(2,'BTC1','w01'):150, (2,'BTC1','w02'):115, (2,'BTC1','w03'):135,
(2,'BOC1','w01'):150, (2,'BOC1','w02'):115, (2,'BOC1','w03'):135}
successors = {'w01':[],'w02':['w01'],'w03':['w02']}
types = ['BTC1','BOC1']
f_cost = {(1,'BTC1'): 50000,(1,'BOC1'): 40000,
(2,'BTC1'): 50000,(2,'BOC1'): 40000}
edges, v_cost = gp.multidict({
(1,'BTC1','w01'): [15],
(1,'BTC1','w02'): [30],
(1,'BTC1','w03'): [45],
(2,'BTC1','w01'): [15],
(2,'BTC1','w02'): [30],
(2,'BTC1','w03'): [45],
(1,'BOC1','w01'): [50],
(1,'BOC1','w02'): [80],
(1,'BOC1','w03'): [110],
(2,'BOC1','w01'): [50],
(2,'BOC1','w02'): [80],
(2,'BOC1','w03'): [110]
})
x_arcs = [(i,j,k) for i in stations for j in types for k in tasks]
y_arcs = [(i,j) for i in stations for j in types]
m = gp.Model()
y = m.addVars(y_arcs, vtype = GRB.BINARY, name = 'y')
x = m.addVars(x_arcs, vtype = GRB.CONTINUOUS, name = 'x',ub=1)
for i in stations:
for j in types:
for k in tasks:
m.addConstr((y[i,j] == 0) >> (x[i,j,k] == 0))
m.addConstrs(quicksum(x[i,j,k] for i in stations for j in types) == 1 for k in tasks)
m.addConstrs(quicksum(durations[i,j,k]*x[i,j,k] for j in types for k in tasks) <= C for i in stations)
m.addConstrs(quicksum(y[i,j] for j in types) == 1 for i in stations)
m.addConstrs(quicksum(x[i,j,k] for i in stations for j in types) <=
quicksum(x[i,j,l] for i in stations for j in types)
for l in tasks for k in successors[l] if l!= 'w01')
m.setObjective(x.prod(v_cost) + y.prod(f_cost), GRB.MINIMIZE)
m.optimize()
What I want is a simple horizontal bar chart where I can get information about which station is assigned to which tasks etc. Basically something like that would be enough:
Therefore I thought of using the example from plotly:
import plotly.express as px
df = px.data.tips()
fig = px.bar(df, x="total_bill", y="sex", color='day', orientation='h',
hover_data=["tip", "size"],
height=400,
title='Restaurant bills')
fig.show()
How can I use this example with my own values? I really appreciate any help so much. Thanks