long render times

I have pared my example down to a minimal example (the data is small but still takes up a lot of vertical room). What I am experiencing is about 10 seconds of render time.

I am trying to figure out if that is an expected length of time or if I have done something glaringly wrong/inefficient in my generation of the plots.

The rendering was taking about 30 seconds, then I sorted the data and now it is down to about 8-10 seconds on a three different machines. That time is consistent when doing ctrl+shift+r to refresh the page and have it loaded again.

Bokeh version: 12.7

I have never had this kind of slowness before, but this is my first time using the gridplot and have been trying different methods for a few days - finally I thought to post here to see if this is the expected render time for plots arranged like this.

Here is the script:

import pandas as pd

from bokeh.plotting import figure, show, output_file

from bokeh.models import LinearAxis, Range1d, ColumnDataSource, NumeralTickFormatter

from bokeh.layouts import gridplot

inputof = {‘attr_z’: {0: ‘TYPE_A’,

1: ‘TYPE_A’,

2: ‘TYPE_A’,

3: ‘TYPE_B’,

4: ‘TYPE_B’,

5: ‘TYPE_B’,

6: ‘TYPE_B’,

7: ‘TYPE_B’,

8: ‘TYPE_B’,

9: ‘TYPE_C’,

10: ‘TYPE_C’,

11: ‘TYPE_C’,

12: ‘TYPE_C’,

13: ‘TYPE_C’,

14: ‘TYPE_C’,

15: ‘TYPE_Z’,

16: ‘TYPE_Z’,

17: ‘TYPE_Z’,

18: ‘TYPE_Z’,

19: ‘TYPE_Z’,

20: ‘TYPE_Z’,

21: ‘TYPE_D’,

22: ‘TYPE_D’,

23: ‘TYPE_D’,

24: ‘TYPE_D’,

25: ‘TYPE_D’,

26: ‘TYPE_D’,

27: ‘TYPE_FF’,

28: ‘TYPE_FF’,

29: ‘TYPE_FF’,

30: ‘TYPE_FF’,

31: ‘TYPE_FF’,

32: ‘TYPE_FF’,

33: ‘TYPE_E’,

34: ‘TYPE_E’,

35: ‘TYPE_E’,

36: ‘TYPE_E’,

37: ‘TYPE_E’,

38: ‘TYPE_E’,

39: ‘TYPE_F’,

40: ‘TYPE_F’,

41: ‘TYPE_F’,

42: ‘TYPE_F’,

43: ‘TYPE_F’,

44: ‘TYPE_F’,

45: ‘TYPE_G’,

46: ‘TYPE_G’,

47: ‘TYPE_G’,

48: ‘TYPE_G’,

49: ‘TYPE_G’,

50: ‘TYPE_G’,

51: ‘TYPE_H’,

52: ‘TYPE_H’,

53: ‘TYPE_H’,

54: ‘TYPE_I’,

55: ‘TYPE_I’,

56: ‘TYPE_I’,

57: ‘TYPE_I’,

58: ‘TYPE_I’,

59: ‘TYPE_I’,

60: ‘TYPE_J’,

61: ‘TYPE_J’,

62: ‘TYPE_J’,

63: ‘TYPE_J’,

64: ‘TYPE_J’,

65: ‘TYPE_J’,

66: ‘TYPE_K’,

67: ‘TYPE_K’,

68: ‘TYPE_K’,

69: ‘TYPE_K’,

70: ‘TYPE_K’,

71: ‘TYPE_K’,

72: ‘TYPE_L’,

73: ‘TYPE_L’,

74: ‘TYPE_L’,

75: ‘TYPE_L’,

76: ‘TYPE_L’,

77: ‘TYPE_L’,

78: ‘TYPE_M’,

79: ‘TYPE_M’,

80: ‘TYPE_M’,

81: ‘TYPE_N’,

82: ‘TYPE_N’,

83: ‘TYPE_N’,

84: ‘TYPE_N’,

85: ‘TYPE_N’,

86: ‘TYPE_N’,

87: ‘TYPE_O’,

88: ‘TYPE_O’,

89: ‘TYPE_O’,

90: ‘TYPE_O’,

91: ‘TYPE_O’,

92: ‘TYPE_O’,

93: ‘TYPE_P’,

94: ‘TYPE_P’,

95: ‘TYPE_P’,

96: ‘TYPE_P’,

97: ‘TYPE_P’,

98: ‘TYPE_P’,

99: ‘TYPE_Q’,

100: ‘TYPE_Q’,

101: ‘TYPE_Q’,

102: ‘TYPE_Q’,

103: ‘TYPE_Q’,

104: ‘TYPE_Q’,

105: ‘TYPE_R’,

106: ‘TYPE_R’,

107: ‘TYPE_R’,

108: ‘TYPE_R’,

109: ‘TYPE_R’,

110: ‘TYPE_R’,

111: ‘TYPE_S’,

112: ‘TYPE_S’,

113: ‘TYPE_S’,

114: ‘TYPE_S’,

115: ‘TYPE_S’,

116: ‘TYPE_S’,

117: ‘TYPE_T’,

118: ‘TYPE_T’,

119: ‘TYPE_T’,

120: ‘TYPE_T’,

121: ‘TYPE_T’,

122: ‘TYPE_T’,

123: ‘TYPE_U’,

124: ‘TYPE_U’,

125: ‘TYPE_U’,

126: ‘TYPE_U’,

127: ‘TYPE_U’,

128: ‘TYPE_U’},

‘actual_color’: {0: ‘#58D68D’,

1: ‘#F5B041’,

2: ‘#D7DF01’,

3: ‘#F5B041’,

4: ‘#F5B041’,

5: ‘#D7DF01’,

6: ‘#D7DF01’,

7: ‘#58D68D’,

8: ‘#58D68D’,

9: ‘#F5B041’,

10: ‘#D7DF01’,

11: ‘#58D68D’,

12: ‘#F5B041’,

13: ‘#58D68D’,

14: ‘#D7DF01’,

15: ‘#D7DF01’,

16: ‘#58D68D’,

17: ‘#58D68D’,

18: ‘#D7DF01’,

19: ‘#F5B041’,

20: ‘#F5B041’,

21: ‘#F5B041’,

22: ‘#58D68D’,

23: ‘#D7DF01’,

24: ‘#F5B041’,

25: ‘#D7DF01’,

26: ‘#58D68D’,

27: ‘#F5B041’,

28: ‘#F5B041’,

29: ‘#58D68D’,

30: ‘#D7DF01’,

31: ‘#58D68D’,

32: ‘#D7DF01’,

33: ‘#D7DF01’,

34: ‘#F5B041’,

35: ‘#58D68D’,

36: ‘#58D68D’,

37: ‘#D7DF01’,

38: ‘#F5B041’,

39: ‘#D7DF01’,

40: ‘#D7DF01’,

41: ‘#58D68D’,

42: ‘#58D68D’,

43: ‘#F5B041’,

44: ‘#F5B041’,

45: ‘#F5B041’,

46: ‘#D7DF01’,

47: ‘#F5B041’,

48: ‘#D7DF01’,

49: ‘#58D68D’,

50: ‘#58D68D’,

51: ‘#58D68D’,

52: ‘#F5B041’,

53: ‘#D7DF01’,

54: ‘#D7DF01’,

55: ‘#58D68D’,

56: ‘#58D68D’,

57: ‘#F5B041’,

58: ‘#F5B041’,

59: ‘#D7DF01’,

60: ‘#D7DF01’,

61: ‘#F5B041’,

62: ‘#D7DF01’,

63: ‘#F5B041’,

64: ‘#58D68D’,

65: ‘#58D68D’,

66: ‘#F5B041’,

67: ‘#D7DF01’,

68: ‘#58D68D’,

69: ‘#F5B041’,

70: ‘#D7DF01’,

71: ‘#58D68D’,

72: ‘#D7DF01’,

73: ‘#F5B041’,

74: ‘#D7DF01’,

75: ‘#F5B041’,

76: ‘#58D68D’,

77: ‘#58D68D’,

78: ‘#F5B041’,

79: ‘#58D68D’,

80: ‘#D7DF01’,

81: ‘#58D68D’,

82: ‘#58D68D’,

83: ‘#D7DF01’,

84: ‘#F5B041’,

85: ‘#D7DF01’,

86: ‘#F5B041’,

87: ‘#D7DF01’,

88: ‘#58D68D’,

89: ‘#F5B041’,

90: ‘#F5B041’,

91: ‘#58D68D’,

92: ‘#D7DF01’,

93: ‘#F5B041’,

94: ‘#D7DF01’,

95: ‘#F5B041’,

96: ‘#58D68D’,

97: ‘#58D68D’,

98: ‘#D7DF01’,

99: ‘#D7DF01’,

100: ‘#D7DF01’,

101: ‘#F5B041’,

102: ‘#F5B041’,

103: ‘#58D68D’,

104: ‘#58D68D’,

105: ‘#58D68D’,

106: ‘#D7DF01’,

107: ‘#D7DF01’,

108: ‘#F5B041’,

109: ‘#58D68D’,

110: ‘#F5B041’,

111: ‘#58D68D’,

112: ‘#D7DF01’,

113: ‘#D7DF01’,

114: ‘#F5B041’,

115: ‘#F5B041’,

116: ‘#58D68D’,

117: ‘#F5B041’,

118: ‘#D7DF01’,

119: ‘#F5B041’,

120: ‘#D7DF01’,

121: ‘#58D68D’,

122: ‘#58D68D’,

123: ‘#F5B041’,

124: ‘#F5B041’,

125: ‘#58D68D’,

126: ‘#58D68D’,

127: ‘#D7DF01’,

128: ‘#D7DF01’},

‘m_color’: {0: 0,

1: 1,

2: 2,

3: 1,

4: 1,

5: 2,

6: 2,

7: 0,

8: 0,

9: 1,

10: 2,

11: 0,

12: 1,

13: 0,

14: 2,

15: 2,

16: 0,

17: 0,

18: 2,

19: 1,

20: 1,

21: 1,

22: 0,

23: 2,

24: 1,

25: 2,

26: 0,

27: 1,

28: 1,

29: 0,

30: 2,

31: 0,

32: 2,

33: 2,

34: 1,

35: 0,

36: 0,

37: 2,

38: 1,

39: 2,

40: 2,

41: 0,

42: 0,

43: 1,

44: 1,

45: 1,

46: 2,

47: 1,

48: 2,

49: 0,

50: 0,

51: 0,

52: 1,

53: 2,

54: 2,

55: 0,

56: 0,

57: 1,

58: 1,

59: 2,

60: 2,

61: 1,

62: 2,

63: 1,

64: 0,

65: 0,

66: 1,

67: 2,

68: 0,

69: 1,

70: 2,

71: 0,

72: 2,

73: 1,

74: 2,

75: 1,

76: 0,

77: 0,

78: 1,

79: 0,

80: 2,

81: 0,

82: 0,

83: 2,

84: 1,

85: 2,

86: 1,

87: 2,

88: 0,

89: 1,

90: 1,

91: 0,

92: 2,

93: 1,

94: 2,

95: 1,

96: 0,

97: 0,

98: 2,

99: 2,

100: 2,

101: 1,

102: 1,

103: 0,

104: 0,

105: 0,

106: 2,

107: 2,

108: 1,

109: 0,

110: 1,

111: 0,

112: 2,

113: 2,

114: 1,

115: 1,

116: 0,

117: 1,

118: 2,

119: 1,

120: 2,

121: 0,

122: 0,

123: 1,

124: 1,

125: 0,

126: 0,

127: 2,

128: 2},

‘m_sorting’: {0: 0,

1: 2,

2: 4,

3: 2,

4: 3,

5: 4,

6: 5,

7: 1,

8: 0,

9: 2,

10: 5,

11: 0,

12: 3,

13: 1,

14: 4,

15: 5,

16: 1,

17: 0,

18: 4,

19: 3,

20: 2,

21: 2,

22: 1,

23: 4,

24: 3,

25: 5,

26: 0,

27: 2,

28: 3,

29: 1,

30: 5,

31: 0,

32: 4,

33: 5,

34: 3,

35: 1,

36: 0,

37: 4,

38: 2,

39: 4,

40: 5,

41: 1,

42: 0,

43: 3,

44: 2,

45: 2,

46: 4,

47: 3,

48: 5,

49: 1,

50: 0,

51: 0,

52: 2,

53: 4,

54: 5,

55: 1,

56: 0,

57: 3,

58: 2,

59: 4,

60: 4,

61: 2,

62: 5,

63: 3,

64: 1,

65: 0,

66: 2,

67: 5,

68: 0,

69: 3,

70: 4,

71: 1,

72: 5,

73: 3,

74: 4,

75: 2,

76: 1,

77: 0,

78: 2,

79: 0,

80: 4,

81: 1,

82: 0,

83: 4,

84: 2,

85: 5,

86: 3,

87: 4,

88: 0,

89: 3,

90: 2,

91: 1,

92: 5,

93: 2,

94: 5,

95: 3,

96: 0,

97: 1,

98: 4,

99: 4,

100: 5,

101: 3,

102: 2,

103: 1,

104: 0,

105: 0,

106: 5,

107: 4,

108: 2,

109: 1,

110: 3,

111: 0,

112: 5,

113: 4,

114: 3,

115: 2,

116: 1,

117: 2,

118: 4,

119: 3,

120: 5,

121: 1,

122: 0,

123: 3,

124: 2,

125: 1,

126: 0,

127: 4,

128: 5},

‘size’: {0: 3,

1: 6,

2: 9,

3: 6,

4: 4,

5: 9,

6: 4,

7: 3,

8: 3,

9: 6,

10: 5,

11: 3,

12: 5,

13: 3,

14: 9,

15: 9,

16: 3,

17: 3,

18: 9,

19: 6,

20: 6,

21: 6,

22: 3,

23: 9,

24: 4,

25: 4,

26: 3,

27: 6,

28: 6,

29: 3,

30: 9,

31: 3,

32: 9,

33: 1,

34: 1,

35: 1,

36: 3,

37: 9,

38: 6,

39: 9,

40: 3,

41: 3,

42: 3,

43: 3,

44: 6,

45: 6,

46: 9,

47: 1,

48: 1,

49: 1,

50: 3,

51: 3,

52: 6,

53: 9,

54: 9,

55: 3,

56: 3,

57: 6,

58: 6,

59: 9,

60: 9,

61: 6,

62: 4,

63: 4,

64: 3,

65: 3,

66: 6,

67: 3,

68: 3,

69: 3,

70: 9,

71: 3,

72: 5,

73: 5,

74: 9,

75: 6,

76: 3,

77: 3,

78: 6,

79: 3,

80: 9,

81: 3,

82: 3,

83: 9,

84: 6,

85: 3,

86: 3,

87: 9,

88: 3,

89: 6,

90: 6,

91: 3,

92: 9,

93: 6,

94: 5,

95: 5,

96: 3,

97: 3,

98: 9,

99: 9,

100: 9,

101: 6,

102: 6,

103: 3,

104: 3,

105: 3,

106: 9,

107: 9,

108: 6,

109: 3,

110: 6,

111: 3,

112: 8,

113: 9,

114: 6,

115: 6,

116: 3,

117: 6,

118: 9,

119: 5,

120: 5,

121: 3,

122: 3,

123: 2,

124: 6,

125: 2,

126: 3,

127: 9,

128: 2},

‘source’: {0: ‘3_weeks_prior’,

1: ‘6_weeks_prior’,

2: ‘9_weeks_prior’,

3: ‘6_weeks_prior’,

4: ‘6_weeks_post’,

5: ‘9_weeks_prior’,

6: ‘9_weeks_post’,

7: ‘3_weeks_post’,

8: ‘3_weeks_prior’,

9: ‘6_weeks_prior’,

10: ‘9_weeks_post’,

11: ‘3_weeks_prior’,

12: ‘6_weeks_post’,

13: ‘3_weeks_post’,

14: ‘9_weeks_prior’,

15: ‘9_weeks_post’,

16: ‘3_weeks_post’,

17: ‘3_weeks_prior’,

18: ‘9_weeks_prior’,

19: ‘6_weeks_post’,

20: ‘6_weeks_prior’,

21: ‘6_weeks_prior’,

22: ‘3_weeks_post’,

23: ‘9_weeks_prior’,

24: ‘6_weeks_post’,

25: ‘9_weeks_post’,

26: ‘3_weeks_prior’,

27: ‘6_weeks_prior’,

28: ‘6_weeks_post’,

29: ‘3_weeks_post’,

30: ‘9_weeks_post’,

31: ‘3_weeks_prior’,

32: ‘9_weeks_prior’,

33: ‘9_weeks_post’,

34: ‘6_weeks_post’,

35: ‘3_weeks_post’,

36: ‘3_weeks_prior’,

37: ‘9_weeks_prior’,

38: ‘6_weeks_prior’,

39: ‘9_weeks_prior’,

40: ‘9_weeks_post’,

41: ‘3_weeks_post’,

42: ‘3_weeks_prior’,

43: ‘6_weeks_post’,

44: ‘6_weeks_prior’,

45: ‘6_weeks_prior’,

46: ‘9_weeks_prior’,

47: ‘6_weeks_post’,

48: ‘9_weeks_post’,

49: ‘3_weeks_post’,

50: ‘3_weeks_prior’,

51: ‘3_weeks_prior’,

52: ‘6_weeks_prior’,

53: ‘9_weeks_prior’,

54: ‘9_weeks_post’,

55: ‘3_weeks_post’,

56: ‘3_weeks_prior’,

57: ‘6_weeks_post’,

58: ‘6_weeks_prior’,

59: ‘9_weeks_prior’,

60: ‘9_weeks_prior’,

61: ‘6_weeks_prior’,

62: ‘9_weeks_post’,

63: ‘6_weeks_post’,

64: ‘3_weeks_post’,

65: ‘3_weeks_prior’,

66: ‘6_weeks_prior’,

67: ‘9_weeks_post’,

68: ‘3_weeks_prior’,

69: ‘6_weeks_post’,

70: ‘9_weeks_prior’,

71: ‘3_weeks_post’,

72: ‘9_weeks_post’,

73: ‘6_weeks_post’,

74: ‘9_weeks_prior’,

75: ‘6_weeks_prior’,

76: ‘3_weeks_post’,

77: ‘3_weeks_prior’,

78: ‘6_weeks_prior’,

79: ‘3_weeks_prior’,

80: ‘9_weeks_prior’,

81: ‘3_weeks_post’,

82: ‘3_weeks_prior’,

83: ‘9_weeks_prior’,

84: ‘6_weeks_prior’,

85: ‘9_weeks_post’,

86: ‘6_weeks_post’,

87: ‘9_weeks_prior’,

88: ‘3_weeks_prior’,

89: ‘6_weeks_post’,

90: ‘6_weeks_prior’,

91: ‘3_weeks_post’,

92: ‘9_weeks_post’,

93: ‘6_weeks_prior’,

94: ‘9_weeks_post’,

95: ‘6_weeks_post’,

96: ‘3_weeks_prior’,

97: ‘3_weeks_post’,

98: ‘9_weeks_prior’,

99: ‘9_weeks_prior’,

100: ‘9_weeks_post’,

101: ‘6_weeks_post’,

102: ‘6_weeks_prior’,

103: ‘3_weeks_post’,

104: ‘3_weeks_prior’,

105: ‘3_weeks_prior’,

106: ‘9_weeks_post’,

107: ‘9_weeks_prior’,

108: ‘6_weeks_prior’,

109: ‘3_weeks_post’,

110: ‘6_weeks_post’,

111: ‘3_weeks_prior’,

112: ‘9_weeks_post’,

113: ‘9_weeks_prior’,

114: ‘6_weeks_post’,

115: ‘6_weeks_prior’,

116: ‘3_weeks_post’,

117: ‘6_weeks_prior’,

118: ‘9_weeks_prior’,

119: ‘6_weeks_post’,

120: ‘9_weeks_post’,

121: ‘3_weeks_post’,

122: ‘3_weeks_prior’,

123: ‘6_weeks_post’,

124: ‘6_weeks_prior’,

125: ‘3_weeks_post’,

126: ‘3_weeks_prior’,

127: ‘9_weeks_prior’,

128: ‘9_weeks_post’},

‘attr_a’: {0: 0.0182370820668693,

1: 0.1010719754977029,

2: 0.16547497446373849,

3: 0.088669950738916245,

4: 0.086330935251798566,

5: 0.11612903225806449,

6: 0.086330935251798566,

7: 0.085714285714285715,

8: 0.029999999999999999,

9: 0.085714285714285715,

10: 0.0,

11: 0.084507042253521125,

12: 0.0,

13: 0.0,

14: 0.21531100478468901,

15: 0.016981132075471701,

16: 0.017341040462427751,

17: 0.067796610169491525,

18: 0.083487940630797772,

19: 0.01714285714285714,

20: 0.067988668555240786,

21: 0.090909090909090912,

22: 0.071428571428571425,

23: 0.17964071856287431,

24: 0.1076233183856502,

25: 0.1076233183856502,

26: 0.074999999999999997,

27: 0.2105263157894737,

28: 0.26785714285714279,

29: 0.052631578947368418,

30: 0.27108433734939757,

31: 0.052631578947368418,

32: 0.36842105263157893,

33: 0.034482758620689648,

34: 0.034482758620689648,

35: 0.034482758620689648,

36: 0.068571428571428575,

37: 0.18435754189944131,

38: 0.1359773371104816,

39: 0.078947368421052641,

40: 0.0,

41: 0.0,

42: 0.041095890410958909,

43: 0.0,

44: 0.039735099337748339,

45: 0.10000000000000001,

46: 0.1417322834645669,

47: 0.042857142857142858,

48: 0.042857142857142858,

49: 0.042857142857142858,

50: 0.028846153846153851,

51: 0.085051546391752567,

52: 0.16195372750642681,

53: 0.31619537275064269,

54: 0.0439453125,

55: 0.0086705202312138737,

56: 0.059829059829059832,

57: 0.03503649635036496,

58: 0.094285714285714278,

59: 0.15517241379310351,

60: 0.1198003327787022,

61: 0.10606060606060611,

62: 0.038314176245210732,

63: 0.038314176245210732,

64: 0.038363171355498722,

65: 0.098984771573604052,

66: 0.046332046332046337,

67: 0.0,

68: 0.0,

69: 0.0,

70: 0.048000000000000001,

71: 0.0,

72: 0.017182130584192441,

73: 0.017182130584192441,

74: 0.1003717472118959,

75: 0.049861495844875349,

76: 0.017341040462427751,

77: 0.01666666666666667,

78: 0.099447513812154692,

79: 0.032608695652173912,

80: 0.19926199261992619,

81: 0.020242914979757089,

82: 0.021186440677966101,

83: 0.0439453125,

84: 0.02178649237472767,

85: 0.020242914979757089,

86: 0.020242914979757089,

87: 0.43984962406015038,

88: 0.035714285714285712,

89: 0.07792207792207792,

90: 0.16949152542372881,

91: 0.036585365853658541,

92: 0.079295154185022032,

93: 0.1061946902654867,

94: 0.05281690140845071,

95: 0.05281690140845071,

96: 0.052325581395348833,

97: 0.017441860465116279,

98: 0.15728155339805819,

99: 0.045454545454545463,

100: 0.0,

101: 0.0,

102: 0.045454545454545463,

103: 0.0,

104: 0.0,

105: 0.01973684210526316,

106: 0.060133630289532287,

107: 0.079120879120879117,

108: 0.039473684210526321,

109: 0.0,

110: 0.040000000000000001,

111: 0.14457831325301199,

112: 0.34449760765550241,

113: 0.32270916334661348,

114: 0.33750000000000002,

115: 0.28742514970059879,

116: 0.14814814814814811,

117: 0.0,

118: 0.0,

119: 0.060975609756097567,

120: 0.060975609756097567,

121: 0.058823529411764712,

122: 0.0,

123: 0.079207920792079209,

124: 0.1584905660377359,

125: 0.079207920792079209,

126: 0.067669172932330823,

127: 0.40198511166253098,

128: 0.079207920792079209}}

spanner_df = pd.DataFrame(inputof)

mdu_list_of = list(spanner_df[‘attr_z’].value_counts().index)

range_of = list(spanner_df[‘source’].value_counts().index)

range_of_mass = spanner_df[[‘source’, ‘m_sorting’]].drop_duplicates()

range_of_mass.sort_values(by=‘m_sorting’, inplace=True)

range_of = list(range_of_mass[‘source’])

final_list =

output_file(“x_mdu_plot.html”)

for mdu in mdu_list_of:

source_of = ColumnDataSource(spanner_df[spanner_df[‘attr_z’] == mdu])

p = figure(plot_height = 500, plot_width = 900,

title="_ " + mdu + " details",

x_axis_label=“Periods of data”,

y_axis_label=“attr_a”,

x_range=range_of,

y_range=(0, spanner_df[spanner_df[‘attr_z’] == mdu][‘attr_a’].max()))

p.vbar(x=‘source’,

top=‘attr_a’,

bottom=0, width=0.5, fill_color=‘actual_color’,

line_color=None,

source=source_of)

p.extra_y_ranges = {“foo”: Range1d(start=0, end=10)}

p.add_layout(LinearAxis(y_range_name=“foo”, axis_label=“Number of areas”, axis_line_dash=‘dotted’), ‘right’)

p.circle(‘source’,

‘size’, color=‘black’,

y_range_name=“foo”,

legend=’# of weeks of data in period’,

#line_dash=‘dotted’,

line_color=‘black’,

fill_alpha=0.1,

radius=0.03,

source=source_of)

p.legend.location = “top_left”

p.legend.background_fill_alpha = 0.1

p.yaxis[0].formatter = NumeralTickFormatter(format=“0.0%”)

final_list.append§

final = gridplot([ for x in final_list])

show(final)

Running the code it looks like there are ~25 plots. Bokeh is definitely tilted towards a certain feature set that make it less desirable for "more, simpler plots". Which isn't to say things can't be improved more in that direction, but that's the case currently. That said, my offhand guess as to what is taking so long (FYI it takes about 3-4 seconds to render on my 2016 MBP) is the layout constraint computation. That happens because all the plots are in a single Bokeh layout layout model (GridPlot in this case). An experiment to try would be to not use a grid plot. Instead, use bokeh.embed.components to embed each plot individually into a template. Then, the layouts of the individual plots will not be coupled together, which may speed up the load time.

Thanks,

Bryan

···

On Sep 6, 2017, at 08:44, [email protected] wrote:

I have pared my example down to a minimal example (the data is small but still takes up a lot of vertical room). What I am experiencing is about 10 seconds of render time.

I am trying to figure out if that is an expected length of time or if I have done something glaringly wrong/inefficient in my generation of the plots.
The rendering was taking about 30 seconds, then I sorted the data and now it is down to about 8-10 seconds on a three different machines. That time is consistent when doing ctrl+shift+r to refresh the page and have it loaded again.

Bokeh version: 12.7

I have never had this kind of slowness before, but this is my first time using the gridplot and have been trying different methods for a few days - finally I thought to post here to see if this is the expected render time for plots arranged like this.

Here is the script:

import pandas as pd

from bokeh.plotting import figure, show, output_file
from bokeh.models import LinearAxis, Range1d, ColumnDataSource, NumeralTickFormatter
from bokeh.layouts import gridplot

inputof = {'attr_z': {0: 'TYPE_A',
  1: 'TYPE_A',
  2: 'TYPE_A',
  3: 'TYPE_B',
  4: 'TYPE_B',
  5: 'TYPE_B',
  6: 'TYPE_B',
  7: 'TYPE_B',
  8: 'TYPE_B',
  9: 'TYPE_C',
  10: 'TYPE_C',
  11: 'TYPE_C',
  12: 'TYPE_C',
  13: 'TYPE_C',
  14: 'TYPE_C',
  15: 'TYPE_Z',
  16: 'TYPE_Z',
  17: 'TYPE_Z',
  18: 'TYPE_Z',
  19: 'TYPE_Z',
  20: 'TYPE_Z',
  21: 'TYPE_D',
  22: 'TYPE_D',
  23: 'TYPE_D',
  24: 'TYPE_D',
  25: 'TYPE_D',
  26: 'TYPE_D',
  27: 'TYPE_FF',
  28: 'TYPE_FF',
  29: 'TYPE_FF',
  30: 'TYPE_FF',
  31: 'TYPE_FF',
  32: 'TYPE_FF',
  33: 'TYPE_E',
  34: 'TYPE_E',
  35: 'TYPE_E',
  36: 'TYPE_E',
  37: 'TYPE_E',
  38: 'TYPE_E',
  39: 'TYPE_F',
  40: 'TYPE_F',
  41: 'TYPE_F',
  42: 'TYPE_F',
  43: 'TYPE_F',
  44: 'TYPE_F',
  45: 'TYPE_G',
  46: 'TYPE_G',
  47: 'TYPE_G',
  48: 'TYPE_G',
  49: 'TYPE_G',
  50: 'TYPE_G',
  51: 'TYPE_H',
  52: 'TYPE_H',
  53: 'TYPE_H',
  54: 'TYPE_I',
  55: 'TYPE_I',
  56: 'TYPE_I',
  57: 'TYPE_I',
  58: 'TYPE_I',
  59: 'TYPE_I',
  60: 'TYPE_J',
  61: 'TYPE_J',
  62: 'TYPE_J',
  63: 'TYPE_J',
  64: 'TYPE_J',
  65: 'TYPE_J',
  66: 'TYPE_K',
  67: 'TYPE_K',
  68: 'TYPE_K',
  69: 'TYPE_K',
  70: 'TYPE_K',
  71: 'TYPE_K',
  72: 'TYPE_L',
  73: 'TYPE_L',
  74: 'TYPE_L',
  75: 'TYPE_L',
  76: 'TYPE_L',
  77: 'TYPE_L',
  78: 'TYPE_M',
  79: 'TYPE_M',
  80: 'TYPE_M',
  81: 'TYPE_N',
  82: 'TYPE_N',
  83: 'TYPE_N',
  84: 'TYPE_N',
  85: 'TYPE_N',
  86: 'TYPE_N',
  87: 'TYPE_O',
  88: 'TYPE_O',
  89: 'TYPE_O',
  90: 'TYPE_O',
  91: 'TYPE_O',
  92: 'TYPE_O',
  93: 'TYPE_P',
  94: 'TYPE_P',
  95: 'TYPE_P',
  96: 'TYPE_P',
  97: 'TYPE_P',
  98: 'TYPE_P',
  99: 'TYPE_Q',
  100: 'TYPE_Q',
  101: 'TYPE_Q',
  102: 'TYPE_Q',
  103: 'TYPE_Q',
  104: 'TYPE_Q',
  105: 'TYPE_R',
  106: 'TYPE_R',
  107: 'TYPE_R',
  108: 'TYPE_R',
  109: 'TYPE_R',
  110: 'TYPE_R',
  111: 'TYPE_S',
  112: 'TYPE_S',
  113: 'TYPE_S',
  114: 'TYPE_S',
  115: 'TYPE_S',
  116: 'TYPE_S',
  117: 'TYPE_T',
  118: 'TYPE_T',
  119: 'TYPE_T',
  120: 'TYPE_T',
  121: 'TYPE_T',
  122: 'TYPE_T',
  123: 'TYPE_U',
  124: 'TYPE_U',
  125: 'TYPE_U',
  126: 'TYPE_U',
  127: 'TYPE_U',
  128: 'TYPE_U'},
'actual_color': {0: '#58D68D',
  1: '#F5B041',
  2: '#D7DF01',
  3: '#F5B041',
  4: '#F5B041',
  5: '#D7DF01',
  6: '#D7DF01',
  7: '#58D68D',
  8: '#58D68D',
  9: '#F5B041',
  10: '#D7DF01',
  11: '#58D68D',
  12: '#F5B041',
  13: '#58D68D',
  14: '#D7DF01',
  15: '#D7DF01',
  16: '#58D68D',
  17: '#58D68D',
  18: '#D7DF01',
  19: '#F5B041',
  20: '#F5B041',
  21: '#F5B041',
  22: '#58D68D',
  23: '#D7DF01',
  24: '#F5B041',
  25: '#D7DF01',
  26: '#58D68D',
  27: '#F5B041',
  28: '#F5B041',
  29: '#58D68D',
  30: '#D7DF01',
  31: '#58D68D',
  32: '#D7DF01',
  33: '#D7DF01',
  34: '#F5B041',
  35: '#58D68D',
  36: '#58D68D',
  37: '#D7DF01',
  38: '#F5B041',
  39: '#D7DF01',
  40: '#D7DF01',
  41: '#58D68D',
  42: '#58D68D',
  43: '#F5B041',
  44: '#F5B041',
  45: '#F5B041',
  46: '#D7DF01',
  47: '#F5B041',
  48: '#D7DF01',
  49: '#58D68D',
  50: '#58D68D',
  51: '#58D68D',
  52: '#F5B041',
  53: '#D7DF01',
  54: '#D7DF01',
  55: '#58D68D',
  56: '#58D68D',
  57: '#F5B041',
  58: '#F5B041',
  59: '#D7DF01',
  60: '#D7DF01',
  61: '#F5B041',
  62: '#D7DF01',
  63: '#F5B041',
  64: '#58D68D',
  65: '#58D68D',
  66: '#F5B041',
  67: '#D7DF01',
  68: '#58D68D',
  69: '#F5B041',
  70: '#D7DF01',
  71: '#58D68D',
  72: '#D7DF01',
  73: '#F5B041',
  74: '#D7DF01',
  75: '#F5B041',
  76: '#58D68D',
  77: '#58D68D',
  78: '#F5B041',
  79: '#58D68D',
  80: '#D7DF01',
  81: '#58D68D',
  82: '#58D68D',
  83: '#D7DF01',
  84: '#F5B041',
  85: '#D7DF01',
  86: '#F5B041',
  87: '#D7DF01',
  88: '#58D68D',
  89: '#F5B041',
  90: '#F5B041',
  91: '#58D68D',
  92: '#D7DF01',
  93: '#F5B041',
  94: '#D7DF01',
  95: '#F5B041',
  96: '#58D68D',
  97: '#58D68D',
  98: '#D7DF01',
  99: '#D7DF01',
  100: '#D7DF01',
  101: '#F5B041',
  102: '#F5B041',
  103: '#58D68D',
  104: '#58D68D',
  105: '#58D68D',
  106: '#D7DF01',
  107: '#D7DF01',
  108: '#F5B041',
  109: '#58D68D',
  110: '#F5B041',
  111: '#58D68D',
  112: '#D7DF01',
  113: '#D7DF01',
  114: '#F5B041',
  115: '#F5B041',
  116: '#58D68D',
  117: '#F5B041',
  118: '#D7DF01',
  119: '#F5B041',
  120: '#D7DF01',
  121: '#58D68D',
  122: '#58D68D',
  123: '#F5B041',
  124: '#F5B041',
  125: '#58D68D',
  126: '#58D68D',
  127: '#D7DF01',
  128: '#D7DF01'},
'm_color': {0: 0,
  1: 1,
  2: 2,
  3: 1,
  4: 1,
  5: 2,
  6: 2,
  7: 0,
  8: 0,
  9: 1,
  10: 2,
  11: 0,
  12: 1,
  13: 0,
  14: 2,
  15: 2,
  16: 0,
  17: 0,
  18: 2,
  19: 1,
  20: 1,
  21: 1,
  22: 0,
  23: 2,
  24: 1,
  25: 2,
  26: 0,
  27: 1,
  28: 1,
  29: 0,
  30: 2,
  31: 0,
  32: 2,
  33: 2,
  34: 1,
  35: 0,
  36: 0,
  37: 2,
  38: 1,
  39: 2,
  40: 2,
  41: 0,
  42: 0,
  43: 1,
  44: 1,
  45: 1,
  46: 2,
  47: 1,
  48: 2,
  49: 0,
  50: 0,
  51: 0,
  52: 1,
  53: 2,
  54: 2,
  55: 0,
  56: 0,
  57: 1,
  58: 1,
  59: 2,
  60: 2,
  61: 1,
  62: 2,
  63: 1,
  64: 0,
  65: 0,
  66: 1,
  67: 2,
  68: 0,
  69: 1,
  70: 2,
  71: 0,
  72: 2,
  73: 1,
  74: 2,
  75: 1,
  76: 0,
  77: 0,
  78: 1,
  79: 0,
  80: 2,
  81: 0,
  82: 0,
  83: 2,
  84: 1,
  85: 2,
  86: 1,
  87: 2,
  88: 0,
  89: 1,
  90: 1,
  91: 0,
  92: 2,
  93: 1,
  94: 2,
  95: 1,
  96: 0,
  97: 0,
  98: 2,
  99: 2,
  100: 2,
  101: 1,
  102: 1,
  103: 0,
  104: 0,
  105: 0,
  106: 2,
  107: 2,
  108: 1,
  109: 0,
  110: 1,
  111: 0,
  112: 2,
  113: 2,
  114: 1,
  115: 1,
  116: 0,
  117: 1,
  118: 2,
  119: 1,
  120: 2,
  121: 0,
  122: 0,
  123: 1,
  124: 1,
  125: 0,
  126: 0,
  127: 2,
  128: 2},
'm_sorting': {0: 0,
  1: 2,
  2: 4,
  3: 2,
  4: 3,
  5: 4,
  6: 5,
  7: 1,
  8: 0,
  9: 2,
  10: 5,
  11: 0,
  12: 3,
  13: 1,
  14: 4,
  15: 5,
  16: 1,
  17: 0,
  18: 4,
  19: 3,
  20: 2,
  21: 2,
  22: 1,
  23: 4,
  24: 3,
  25: 5,
  26: 0,
  27: 2,
  28: 3,
  29: 1,
  30: 5,
  31: 0,
  32: 4,
  33: 5,
  34: 3,
  35: 1,
  36: 0,
  37: 4,
  38: 2,
  39: 4,
  40: 5,
  41: 1,
  42: 0,
  43: 3,
  44: 2,
  45: 2,
  46: 4,
  47: 3,
  48: 5,
  49: 1,
  50: 0,
  51: 0,
  52: 2,
  53: 4,
  54: 5,
  55: 1,
  56: 0,
  57: 3,
  58: 2,
  59: 4,
  60: 4,
  61: 2,
  62: 5,
  63: 3,
  64: 1,
  65: 0,
  66: 2,
  67: 5,
  68: 0,
  69: 3,
  70: 4,
  71: 1,
  72: 5,
  73: 3,
  74: 4,
  75: 2,
  76: 1,
  77: 0,
  78: 2,
  79: 0,
  80: 4,
  81: 1,
  82: 0,
  83: 4,
  84: 2,
  85: 5,
  86: 3,
  87: 4,
  88: 0,
  89: 3,
  90: 2,
  91: 1,
  92: 5,
  93: 2,
  94: 5,
  95: 3,
  96: 0,
  97: 1,
  98: 4,
  99: 4,
  100: 5,
  101: 3,
  102: 2,
  103: 1,
  104: 0,
  105: 0,
  106: 5,
  107: 4,
  108: 2,
  109: 1,
  110: 3,
  111: 0,
  112: 5,
  113: 4,
  114: 3,
  115: 2,
  116: 1,
  117: 2,
  118: 4,
  119: 3,
  120: 5,
  121: 1,
  122: 0,
  123: 3,
  124: 2,
  125: 1,
  126: 0,
  127: 4,
  128: 5},
'size': {0: 3,
  1: 6,
  2: 9,
  3: 6,
  4: 4,
  5: 9,
  6: 4,
  7: 3,
  8: 3,
  9: 6,
  10: 5,
  11: 3,
  12: 5,
  13: 3,
  14: 9,
  15: 9,
  16: 3,
  17: 3,
  18: 9,
  19: 6,
  20: 6,
  21: 6,
  22: 3,
  23: 9,
  24: 4,
  25: 4,
  26: 3,
  27: 6,
  28: 6,
  29: 3,
  30: 9,
  31: 3,
  32: 9,
  33: 1,
  34: 1,
  35: 1,
  36: 3,
  37: 9,
  38: 6,
  39: 9,
  40: 3,
  41: 3,
  42: 3,
  43: 3,
  44: 6,
  45: 6,
  46: 9,
  47: 1,
  48: 1,
  49: 1,
  50: 3,
  51: 3,
  52: 6,
  53: 9,
  54: 9,
  55: 3,
  56: 3,
  57: 6,
  58: 6,
  59: 9,
  60: 9,
  61: 6,
  62: 4,
  63: 4,
  64: 3,
  65: 3,
  66: 6,
  67: 3,
  68: 3,
  69: 3,
  70: 9,
  71: 3,
  72: 5,
  73: 5,
  74: 9,
  75: 6,
  76: 3,
  77: 3,
  78: 6,
  79: 3,
  80: 9,
  81: 3,
  82: 3,
  83: 9,
  84: 6,
  85: 3,
  86: 3,
  87: 9,
  88: 3,
  89: 6,
  90: 6,
  91: 3,
  92: 9,
  93: 6,
  94: 5,
  95: 5,
  96: 3,
  97: 3,
  98: 9,
  99: 9,
  100: 9,
  101: 6,
  102: 6,
  103: 3,
  104: 3,
  105: 3,
  106: 9,
  107: 9,
  108: 6,
  109: 3,
  110: 6,
  111: 3,
  112: 8,
  113: 9,
  114: 6,
  115: 6,
  116: 3,
  117: 6,
  118: 9,
  119: 5,
  120: 5,
  121: 3,
  122: 3,
  123: 2,
  124: 6,
  125: 2,
  126: 3,
  127: 9,
  128: 2},
'source': {0: '3_weeks_prior',
  1: '6_weeks_prior',
  2: '9_weeks_prior',
  3: '6_weeks_prior',
  4: '6_weeks_post',
  5: '9_weeks_prior',
  6: '9_weeks_post',
  7: '3_weeks_post',
  8: '3_weeks_prior',
  9: '6_weeks_prior',
  10: '9_weeks_post',
  11: '3_weeks_prior',
  12: '6_weeks_post',
  13: '3_weeks_post',
  14: '9_weeks_prior',
  15: '9_weeks_post',
  16: '3_weeks_post',
  17: '3_weeks_prior',
  18: '9_weeks_prior',
  19: '6_weeks_post',
  20: '6_weeks_prior',
  21: '6_weeks_prior',
  22: '3_weeks_post',
  23: '9_weeks_prior',
  24: '6_weeks_post',
  25: '9_weeks_post',
  26: '3_weeks_prior',
  27: '6_weeks_prior',
  28: '6_weeks_post',
  29: '3_weeks_post',
  30: '9_weeks_post',
  31: '3_weeks_prior',
  32: '9_weeks_prior',
  33: '9_weeks_post',
  34: '6_weeks_post',
  35: '3_weeks_post',
  36: '3_weeks_prior',
  37: '9_weeks_prior',
  38: '6_weeks_prior',
  39: '9_weeks_prior',
  40: '9_weeks_post',
  41: '3_weeks_post',
  42: '3_weeks_prior',
  43: '6_weeks_post',
  44: '6_weeks_prior',
  45: '6_weeks_prior',
  46: '9_weeks_prior',
  47: '6_weeks_post',
  48: '9_weeks_post',
  49: '3_weeks_post',
  50: '3_weeks_prior',
  51: '3_weeks_prior',
  52: '6_weeks_prior',
  53: '9_weeks_prior',
  54: '9_weeks_post',
  55: '3_weeks_post',
  56: '3_weeks_prior',
  57: '6_weeks_post',
  58: '6_weeks_prior',
  59: '9_weeks_prior',
  60: '9_weeks_prior',
  61: '6_weeks_prior',
  62: '9_weeks_post',
  63: '6_weeks_post',
  64: '3_weeks_post',
  65: '3_weeks_prior',
  66: '6_weeks_prior',
  67: '9_weeks_post',
  68: '3_weeks_prior',
  69: '6_weeks_post',
  70: '9_weeks_prior',
  71: '3_weeks_post',
  72: '9_weeks_post',
  73: '6_weeks_post',
  74: '9_weeks_prior',
  75: '6_weeks_prior',
  76: '3_weeks_post',
  77: '3_weeks_prior',
  78: '6_weeks_prior',
  79: '3_weeks_prior',
  80: '9_weeks_prior',
  81: '3_weeks_post',
  82: '3_weeks_prior',
  83: '9_weeks_prior',
  84: '6_weeks_prior',
  85: '9_weeks_post',
  86: '6_weeks_post',
  87: '9_weeks_prior',
  88: '3_weeks_prior',
  89: '6_weeks_post',
  90: '6_weeks_prior',
  91: '3_weeks_post',
  92: '9_weeks_post',
  93: '6_weeks_prior',
  94: '9_weeks_post',
  95: '6_weeks_post',
  96: '3_weeks_prior',
  97: '3_weeks_post',
  98: '9_weeks_prior',
  99: '9_weeks_prior',
  100: '9_weeks_post',
  101: '6_weeks_post',
  102: '6_weeks_prior',
  103: '3_weeks_post',
  104: '3_weeks_prior',
  105: '3_weeks_prior',
  106: '9_weeks_post',
  107: '9_weeks_prior',
  108: '6_weeks_prior',
  109: '3_weeks_post',
  110: '6_weeks_post',
  111: '3_weeks_prior',
  112: '9_weeks_post',
  113: '9_weeks_prior',
  114: '6_weeks_post',
  115: '6_weeks_prior',
  116: '3_weeks_post',
  117: '6_weeks_prior',
  118: '9_weeks_prior',
  119: '6_weeks_post',
  120: '9_weeks_post',
  121: '3_weeks_post',
  122: '3_weeks_prior',
  123: '6_weeks_post',
  124: '6_weeks_prior',
  125: '3_weeks_post',
  126: '3_weeks_prior',
  127: '9_weeks_prior',
  128: '9_weeks_post'},
'attr_a': {0: 0.0182370820668693,
  1: 0.1010719754977029,
  2: 0.16547497446373849,
  3: 0.088669950738916245,
  4: 0.086330935251798566,
  5: 0.11612903225806449,
  6: 0.086330935251798566,
  7: 0.085714285714285715,
  8: 0.029999999999999999,
  9: 0.085714285714285715,
  10: 0.0,
  11: 0.084507042253521125,
  12: 0.0,
  13: 0.0,
  14: 0.21531100478468901,
  15: 0.016981132075471701,
  16: 0.017341040462427751,
  17: 0.067796610169491525,
  18: 0.083487940630797772,
  19: 0.01714285714285714,
  20: 0.067988668555240786,
  21: 0.090909090909090912,
  22: 0.071428571428571425,
  23: 0.17964071856287431,
  24: 0.1076233183856502,
  25: 0.1076233183856502,
  26: 0.074999999999999997,
  27: 0.2105263157894737,
  28: 0.26785714285714279,
  29: 0.052631578947368418,
  30: 0.27108433734939757,
  31: 0.052631578947368418,
  32: 0.36842105263157893,
  33: 0.034482758620689648,
  34: 0.034482758620689648,
  35: 0.034482758620689648,
  36: 0.068571428571428575,
  37: 0.18435754189944131,
  38: 0.1359773371104816,
  39: 0.078947368421052641,
  40: 0.0,
  41: 0.0,
  42: 0.041095890410958909,
  43: 0.0,
  44: 0.039735099337748339,
  45: 0.10000000000000001,
  46: 0.1417322834645669,
  47: 0.042857142857142858,
  48: 0.042857142857142858,
  49: 0.042857142857142858,
  50: 0.028846153846153851,
  51: 0.085051546391752567,
  52: 0.16195372750642681,
  53: 0.31619537275064269,
  54: 0.0439453125,
  55: 0.0086705202312138737,
  56: 0.059829059829059832,
  57: 0.03503649635036496,
  58: 0.094285714285714278,
  59: 0.15517241379310351,
  60: 0.1198003327787022,
  61: 0.10606060606060611,
  62: 0.038314176245210732,
  63: 0.038314176245210732,
  64: 0.038363171355498722,
  65: 0.098984771573604052,
  66: 0.046332046332046337,
  67: 0.0,
  68: 0.0,
  69: 0.0,
  70: 0.048000000000000001,
  71: 0.0,
  72: 0.017182130584192441,
  73: 0.017182130584192441,
  74: 0.1003717472118959,
  75: 0.049861495844875349,
  76: 0.017341040462427751,
  77: 0.01666666666666667,
  78: 0.099447513812154692,
  79: 0.032608695652173912,
  80: 0.19926199261992619,
  81: 0.020242914979757089,
  82: 0.021186440677966101,
  83: 0.0439453125,
  84: 0.02178649237472767,
  85: 0.020242914979757089,
  86: 0.020242914979757089,
  87: 0.43984962406015038,
  88: 0.035714285714285712,
  89: 0.07792207792207792,
  90: 0.16949152542372881,
  91: 0.036585365853658541,
  92: 0.079295154185022032,
  93: 0.1061946902654867,
  94: 0.05281690140845071,
  95: 0.05281690140845071,
  96: 0.052325581395348833,
  97: 0.017441860465116279,
  98: 0.15728155339805819,
  99: 0.045454545454545463,
  100: 0.0,
  101: 0.0,
  102: 0.045454545454545463,
  103: 0.0,
  104: 0.0,
  105: 0.01973684210526316,
  106: 0.060133630289532287,
  107: 0.079120879120879117,
  108: 0.039473684210526321,
  109: 0.0,
  110: 0.040000000000000001,
  111: 0.14457831325301199,
  112: 0.34449760765550241,
  113: 0.32270916334661348,
  114: 0.33750000000000002,
  115: 0.28742514970059879,
  116: 0.14814814814814811,
  117: 0.0,
  118: 0.0,
  119: 0.060975609756097567,
  120: 0.060975609756097567,
  121: 0.058823529411764712,
  122: 0.0,
  123: 0.079207920792079209,
  124: 0.1584905660377359,
  125: 0.079207920792079209,
  126: 0.067669172932330823,
  127: 0.40198511166253098,
  128: 0.079207920792079209}}

spanner_df = pd.DataFrame(inputof)

mdu_list_of = list(spanner_df['attr_z'].value_counts().index)
range_of = list(spanner_df['source'].value_counts().index)
range_of_mass = spanner_df[['source', 'm_sorting']].drop_duplicates()
range_of_mass.sort_values(by='m_sorting', inplace=True)
range_of = list(range_of_mass['source'])

final_list =
output_file("x_mdu_plot.html")
for mdu in mdu_list_of:
    source_of = ColumnDataSource(spanner_df[spanner_df['attr_z'] == mdu])
    p = figure(plot_height = 500, plot_width = 900,
            title="_ " + mdu + " details",
            x_axis_label="Periods of data",
            y_axis_label="attr_a",
            x_range=range_of,
            y_range=(0, spanner_df[spanner_df['attr_z'] == mdu]['attr_a'].max()))

    p.vbar(x='source',
            top='attr_a',
            bottom=0, width=0.5, fill_color='actual_color',
            line_color=None,
            source=source_of)

    p.extra_y_ranges = {"foo": Range1d(start=0, end=10)}
    p.add_layout(LinearAxis(y_range_name="foo", axis_label="Number of areas", axis_line_dash='dotted'), 'right')
    p.circle('source',
            'size', color='black',
            y_range_name="foo",
            legend='# of weeks of data in period',
            #line_dash='dotted',
            line_color='black',
            fill_alpha=0.1,
            radius=0.03,
            source=source_of)
    
    p.legend.location = "top_left"
    p.legend.background_fill_alpha = 0.1
    p.yaxis[0].formatter = NumeralTickFormatter(format="0.0%")
    final_list.append(p)
final = gridplot([ for x in final_list])
show(final)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3c2537a8-b9dd-4df3-85bb-46474f0e1561%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Bryan, thanks for the context you provided to look at the problem and for the ideas. I will try those out.
Thank you for taking the time.

···

On Wednesday, September 6, 2017 at 10:33:00 AM UTC-4, Bryan Van de ven wrote:

Running the code it looks like there are ~25 plots. Bokeh is definitely tilted towards a certain feature set that make it less desirable for “more, simpler plots”. Which isn’t to say things can’t be improved more in that direction, but that’s the case currently. That said, my offhand guess as to what is taking so long (FYI it takes about 3-4 seconds to render on my 2016 MBP) is the layout constraint computation. That happens because all the plots are in a single Bokeh layout layout model (GridPlot in this case). An experiment to try would be to not use a grid plot. Instead, use bokeh.embed.components to embed each plot individually into a template. Then, the layouts of the individual plots will not be coupled together, which may speed up the load time.

Thanks,

Bryan

On Sep 6, 2017, at 08:44, [email protected] wrote:

I have pared my example down to a minimal example (the data is small but still takes up a lot of vertical room). What I am experiencing is about 10 seconds of render time.

I am trying to figure out if that is an expected length of time or if I have done something glaringly wrong/inefficient in my generation of the plots.

The rendering was taking about 30 seconds, then I sorted the data and now it is down to about 8-10 seconds on a three different machines. That time is consistent when doing ctrl+shift+r to refresh the page and have it loaded again.

Bokeh version: 12.7

I have never had this kind of slowness before, but this is my first time using the gridplot and have been trying different methods for a few days - finally I thought to post here to see if this is the expected render time for plots arranged like this.

Here is the script:

import pandas as pd

from bokeh.plotting import figure, show, output_file

from bokeh.models import LinearAxis, Range1d, ColumnDataSource, NumeralTickFormatter

from bokeh.layouts import gridplot

inputof = {‘attr_z’: {0: ‘TYPE_A’,

1: ‘TYPE_A’,

2: ‘TYPE_A’,

3: ‘TYPE_B’,

4: ‘TYPE_B’,

5: ‘TYPE_B’,

6: ‘TYPE_B’,

7: ‘TYPE_B’,

8: ‘TYPE_B’,

9: ‘TYPE_C’,

10: ‘TYPE_C’,

11: ‘TYPE_C’,

12: ‘TYPE_C’,

13: ‘TYPE_C’,

14: ‘TYPE_C’,

15: ‘TYPE_Z’,

16: ‘TYPE_Z’,

17: ‘TYPE_Z’,

18: ‘TYPE_Z’,

19: ‘TYPE_Z’,

20: ‘TYPE_Z’,

21: ‘TYPE_D’,

22: ‘TYPE_D’,

23: ‘TYPE_D’,

24: ‘TYPE_D’,

25: ‘TYPE_D’,

26: ‘TYPE_D’,

27: ‘TYPE_FF’,

28: ‘TYPE_FF’,

29: ‘TYPE_FF’,

30: ‘TYPE_FF’,

31: ‘TYPE_FF’,

32: ‘TYPE_FF’,

33: ‘TYPE_E’,

34: ‘TYPE_E’,

35: ‘TYPE_E’,

36: ‘TYPE_E’,

37: ‘TYPE_E’,

38: ‘TYPE_E’,

39: ‘TYPE_F’,

40: ‘TYPE_F’,

41: ‘TYPE_F’,

42: ‘TYPE_F’,

43: ‘TYPE_F’,

44: ‘TYPE_F’,

45: ‘TYPE_G’,

46: ‘TYPE_G’,

47: ‘TYPE_G’,

48: ‘TYPE_G’,

49: ‘TYPE_G’,

50: ‘TYPE_G’,

51: ‘TYPE_H’,

52: ‘TYPE_H’,

53: ‘TYPE_H’,

54: ‘TYPE_I’,

55: ‘TYPE_I’,

56: ‘TYPE_I’,

57: ‘TYPE_I’,

58: ‘TYPE_I’,

59: ‘TYPE_I’,

60: ‘TYPE_J’,

61: ‘TYPE_J’,

62: ‘TYPE_J’,

63: ‘TYPE_J’,

64: ‘TYPE_J’,

65: ‘TYPE_J’,

66: ‘TYPE_K’,

67: ‘TYPE_K’,

68: ‘TYPE_K’,

69: ‘TYPE_K’,

70: ‘TYPE_K’,

71: ‘TYPE_K’,

72: ‘TYPE_L’,

73: ‘TYPE_L’,

74: ‘TYPE_L’,

75: ‘TYPE_L’,

76: ‘TYPE_L’,

77: ‘TYPE_L’,

78: ‘TYPE_M’,

79: ‘TYPE_M’,

80: ‘TYPE_M’,

81: ‘TYPE_N’,

82: ‘TYPE_N’,

83: ‘TYPE_N’,

84: ‘TYPE_N’,

85: ‘TYPE_N’,

86: ‘TYPE_N’,

87: ‘TYPE_O’,

88: ‘TYPE_O’,

89: ‘TYPE_O’,

90: ‘TYPE_O’,

91: ‘TYPE_O’,

92: ‘TYPE_O’,

93: ‘TYPE_P’,

94: ‘TYPE_P’,

95: ‘TYPE_P’,

96: ‘TYPE_P’,

97: ‘TYPE_P’,

98: ‘TYPE_P’,

99: ‘TYPE_Q’,

100: ‘TYPE_Q’,

101: ‘TYPE_Q’,

102: ‘TYPE_Q’,

103: ‘TYPE_Q’,

104: ‘TYPE_Q’,

105: ‘TYPE_R’,

106: ‘TYPE_R’,

107: ‘TYPE_R’,

108: ‘TYPE_R’,

109: ‘TYPE_R’,

110: ‘TYPE_R’,

111: ‘TYPE_S’,

112: ‘TYPE_S’,

113: ‘TYPE_S’,

114: ‘TYPE_S’,

115: ‘TYPE_S’,

116: ‘TYPE_S’,

117: ‘TYPE_T’,

118: ‘TYPE_T’,

119: ‘TYPE_T’,

120: ‘TYPE_T’,

121: ‘TYPE_T’,

122: ‘TYPE_T’,

123: ‘TYPE_U’,

124: ‘TYPE_U’,

125: ‘TYPE_U’,

126: ‘TYPE_U’,

127: ‘TYPE_U’,

128: ‘TYPE_U’},

‘actual_color’: {0: ‘#58D68D’,

1: ‘#F5B041’,

2: ‘#D7DF01’,

3: ‘#F5B041’,

4: ‘#F5B041’,

5: ‘#D7DF01’,

6: ‘#D7DF01’,

7: ‘#58D68D’,

8: ‘#58D68D’,

9: ‘#F5B041’,

10: ‘#D7DF01’,

11: ‘#58D68D’,

12: ‘#F5B041’,

13: ‘#58D68D’,

14: ‘#D7DF01’,

15: ‘#D7DF01’,

16: ‘#58D68D’,

17: ‘#58D68D’,

18: ‘#D7DF01’,

19: ‘#F5B041’,

20: ‘#F5B041’,

21: ‘#F5B041’,

22: ‘#58D68D’,

23: ‘#D7DF01’,

24: ‘#F5B041’,

25: ‘#D7DF01’,

26: ‘#58D68D’,

27: ‘#F5B041’,

28: ‘#F5B041’,

29: ‘#58D68D’,

30: ‘#D7DF01’,

31: ‘#58D68D’,

32: ‘#D7DF01’,

33: ‘#D7DF01’,

34: ‘#F5B041’,

35: ‘#58D68D’,

36: ‘#58D68D’,

37: ‘#D7DF01’,

38: ‘#F5B041’,

39: ‘#D7DF01’,

40: ‘#D7DF01’,

41: ‘#58D68D’,

42: ‘#58D68D’,

43: ‘#F5B041’,

44: ‘#F5B041’,

45: ‘#F5B041’,

46: ‘#D7DF01’,

47: ‘#F5B041’,

48: ‘#D7DF01’,

49: ‘#58D68D’,

50: ‘#58D68D’,

51: ‘#58D68D’,

52: ‘#F5B041’,

53: ‘#D7DF01’,

54: ‘#D7DF01’,

55: ‘#58D68D’,

56: ‘#58D68D’,

57: ‘#F5B041’,

58: ‘#F5B041’,

59: ‘#D7DF01’,

60: ‘#D7DF01’,

61: ‘#F5B041’,

62: ‘#D7DF01’,

63: ‘#F5B041’,

64: ‘#58D68D’,

65: ‘#58D68D’,

66: ‘#F5B041’,

67: ‘#D7DF01’,

68: ‘#58D68D’,

69: ‘#F5B041’,

70: ‘#D7DF01’,

71: ‘#58D68D’,

72: ‘#D7DF01’,

73: ‘#F5B041’,

74: ‘#D7DF01’,

75: ‘#F5B041’,

76: ‘#58D68D’,

77: ‘#58D68D’,

78: ‘#F5B041’,

79: ‘#58D68D’,

80: ‘#D7DF01’,

81: ‘#58D68D’,

82: ‘#58D68D’,

83: ‘#D7DF01’,

84: ‘#F5B041’,

85: ‘#D7DF01’,

86: ‘#F5B041’,

87: ‘#D7DF01’,

88: ‘#58D68D’,

89: ‘#F5B041’,

90: ‘#F5B041’,

91: ‘#58D68D’,

92: ‘#D7DF01’,

93: ‘#F5B041’,

94: ‘#D7DF01’,

95: ‘#F5B041’,

96: ‘#58D68D’,

97: ‘#58D68D’,

98: ‘#D7DF01’,

99: ‘#D7DF01’,

100: ‘#D7DF01’,

101: ‘#F5B041’,

102: ‘#F5B041’,

103: ‘#58D68D’,

104: ‘#58D68D’,

105: ‘#58D68D’,

106: ‘#D7DF01’,

107: ‘#D7DF01’,

108: ‘#F5B041’,

109: ‘#58D68D’,

110: ‘#F5B041’,

111: ‘#58D68D’,

112: ‘#D7DF01’,

113: ‘#D7DF01’,

114: ‘#F5B041’,

115: ‘#F5B041’,

116: ‘#58D68D’,

117: ‘#F5B041’,

118: ‘#D7DF01’,

119: ‘#F5B041’,

120: ‘#D7DF01’,

121: ‘#58D68D’,

122: ‘#58D68D’,

123: ‘#F5B041’,

124: ‘#F5B041’,

125: ‘#58D68D’,

126: ‘#58D68D’,

127: ‘#D7DF01’,

128: ‘#D7DF01’},

‘m_color’: {0: 0,

1: 1,

2: 2,

3: 1,

4: 1,

5: 2,

6: 2,

7: 0,

8: 0,

9: 1,

10: 2,

11: 0,

12: 1,

13: 0,

14: 2,

15: 2,

16: 0,

17: 0,

18: 2,

19: 1,

20: 1,

21: 1,

22: 0,

23: 2,

24: 1,

25: 2,

26: 0,

27: 1,

28: 1,

29: 0,

30: 2,

31: 0,

32: 2,

33: 2,

34: 1,

35: 0,

36: 0,

37: 2,

38: 1,

39: 2,

40: 2,

41: 0,

42: 0,

43: 1,

44: 1,

45: 1,

46: 2,

47: 1,

48: 2,

49: 0,

50: 0,

51: 0,

52: 1,

53: 2,

54: 2,

55: 0,

56: 0,

57: 1,

58: 1,

59: 2,

60: 2,

61: 1,

62: 2,

63: 1,

64: 0,

65: 0,

66: 1,

67: 2,

68: 0,

69: 1,

70: 2,

71: 0,

72: 2,

73: 1,

74: 2,

75: 1,

76: 0,

77: 0,

78: 1,

79: 0,

80: 2,

81: 0,

82: 0,

83: 2,

84: 1,

85: 2,

86: 1,

87: 2,

88: 0,

89: 1,

90: 1,

91: 0,

92: 2,

93: 1,

94: 2,

95: 1,

96: 0,

97: 0,

98: 2,

99: 2,

100: 2,

101: 1,

102: 1,

103: 0,

104: 0,

105: 0,

106: 2,

107: 2,

108: 1,

109: 0,

110: 1,

111: 0,

112: 2,

113: 2,

114: 1,

115: 1,

116: 0,

117: 1,

118: 2,

119: 1,

120: 2,

121: 0,

122: 0,

123: 1,

124: 1,

125: 0,

126: 0,

127: 2,

128: 2},

‘m_sorting’: {0: 0,

1: 2,

2: 4,

3: 2,

4: 3,

5: 4,

6: 5,

7: 1,

8: 0,

9: 2,

10: 5,

11: 0,

12: 3,

13: 1,

14: 4,

15: 5,

16: 1,

17: 0,

18: 4,

19: 3,

20: 2,

21: 2,

22: 1,

23: 4,

24: 3,

25: 5,

26: 0,

27: 2,

28: 3,

29: 1,

30: 5,

31: 0,

32: 4,

33: 5,

34: 3,

35: 1,

36: 0,

37: 4,

38: 2,

39: 4,

40: 5,

41: 1,

42: 0,

43: 3,

44: 2,

45: 2,

46: 4,

47: 3,

48: 5,

49: 1,

50: 0,

51: 0,

52: 2,

53: 4,

54: 5,

55: 1,

56: 0,

57: 3,

58: 2,

59: 4,

60: 4,

61: 2,

62: 5,

63: 3,

64: 1,

65: 0,

66: 2,

67: 5,

68: 0,

69: 3,

70: 4,

71: 1,

72: 5,

73: 3,

74: 4,

75: 2,

76: 1,

77: 0,

78: 2,

79: 0,

80: 4,

81: 1,

82: 0,

83: 4,

84: 2,

85: 5,

86: 3,

87: 4,

88: 0,

89: 3,

90: 2,

91: 1,

92: 5,

93: 2,

94: 5,

95: 3,

96: 0,

97: 1,

98: 4,

99: 4,

100: 5,

101: 3,

102: 2,

103: 1,

104: 0,

105: 0,

106: 5,

107: 4,

108: 2,

109: 1,

110: 3,

111: 0,

112: 5,

113: 4,

114: 3,

115: 2,

116: 1,

117: 2,

118: 4,

119: 3,

120: 5,

121: 1,

122: 0,

123: 3,

124: 2,

125: 1,

126: 0,

127: 4,

128: 5},

‘size’: {0: 3,

1: 6,

2: 9,

3: 6,

4: 4,

5: 9,

6: 4,

7: 3,

8: 3,

9: 6,

10: 5,

11: 3,

12: 5,

13: 3,

14: 9,

15: 9,

16: 3,

17: 3,

18: 9,

19: 6,

20: 6,

21: 6,

22: 3,

23: 9,

24: 4,

25: 4,

26: 3,

27: 6,

28: 6,

29: 3,

30: 9,

31: 3,

32: 9,

33: 1,

34: 1,

35: 1,

36: 3,

37: 9,

38: 6,

39: 9,

40: 3,

41: 3,

42: 3,

43: 3,

44: 6,

45: 6,

46: 9,

47: 1,

48: 1,

49: 1,

50: 3,

51: 3,

52: 6,

53: 9,

54: 9,

55: 3,

56: 3,

57: 6,

58: 6,

59: 9,

60: 9,

61: 6,

62: 4,

63: 4,

64: 3,

65: 3,

66: 6,

67: 3,

68: 3,

69: 3,

70: 9,

71: 3,

72: 5,

73: 5,

74: 9,

75: 6,

76: 3,

77: 3,

78: 6,

79: 3,

80: 9,

81: 3,

82: 3,

83: 9,

84: 6,

85: 3,

86: 3,

87: 9,

88: 3,

89: 6,

90: 6,

91: 3,

92: 9,

93: 6,

94: 5,

95: 5,

96: 3,

97: 3,

98: 9,

99: 9,

100: 9,

101: 6,

102: 6,

103: 3,

104: 3,

105: 3,

106: 9,

107: 9,

108: 6,

109: 3,

110: 6,

111: 3,

112: 8,

113: 9,

114: 6,

115: 6,

116: 3,

117: 6,

118: 9,

119: 5,

120: 5,

121: 3,

122: 3,

123: 2,

124: 6,

125: 2,

126: 3,

127: 9,

128: 2},

‘source’: {0: ‘3_weeks_prior’,

1: ‘6_weeks_prior’,

2: ‘9_weeks_prior’,

3: ‘6_weeks_prior’,

4: ‘6_weeks_post’,

5: ‘9_weeks_prior’,

6: ‘9_weeks_post’,

7: ‘3_weeks_post’,

8: ‘3_weeks_prior’,

9: ‘6_weeks_prior’,

10: ‘9_weeks_post’,

11: ‘3_weeks_prior’,

12: ‘6_weeks_post’,

13: ‘3_weeks_post’,

14: ‘9_weeks_prior’,

15: ‘9_weeks_post’,

16: ‘3_weeks_post’,

17: ‘3_weeks_prior’,

18: ‘9_weeks_prior’,

19: ‘6_weeks_post’,

20: ‘6_weeks_prior’,

21: ‘6_weeks_prior’,

22: ‘3_weeks_post’,

23: ‘9_weeks_prior’,

24: ‘6_weeks_post’,

25: ‘9_weeks_post’,

26: ‘3_weeks_prior’,

27: ‘6_weeks_prior’,

28: ‘6_weeks_post’,

29: ‘3_weeks_post’,

30: ‘9_weeks_post’,

31: ‘3_weeks_prior’,

32: ‘9_weeks_prior’,

33: ‘9_weeks_post’,

34: ‘6_weeks_post’,

35: ‘3_weeks_post’,

36: ‘3_weeks_prior’,

37: ‘9_weeks_prior’,

38: ‘6_weeks_prior’,

39: ‘9_weeks_prior’,

40: ‘9_weeks_post’,

41: ‘3_weeks_post’,

42: ‘3_weeks_prior’,

43: ‘6_weeks_post’,

44: ‘6_weeks_prior’,

45: ‘6_weeks_prior’,

46: ‘9_weeks_prior’,

47: ‘6_weeks_post’,

48: ‘9_weeks_post’,

49: ‘3_weeks_post’,

50: ‘3_weeks_prior’,

51: ‘3_weeks_prior’,

52: ‘6_weeks_prior’,

53: ‘9_weeks_prior’,

54: ‘9_weeks_post’,

55: ‘3_weeks_post’,

56: ‘3_weeks_prior’,

57: ‘6_weeks_post’,

58: ‘6_weeks_prior’,

59: ‘9_weeks_prior’,

60: ‘9_weeks_prior’,

61: ‘6_weeks_prior’,

62: ‘9_weeks_post’,

63: ‘6_weeks_post’,

64: ‘3_weeks_post’,

65: ‘3_weeks_prior’,

66: ‘6_weeks_prior’,

67: ‘9_weeks_post’,

68: ‘3_weeks_prior’,

69: ‘6_weeks_post’,

70: ‘9_weeks_prior’,

71: ‘3_weeks_post’,

72: ‘9_weeks_post’,

73: ‘6_weeks_post’,

74: ‘9_weeks_prior’,

75: ‘6_weeks_prior’,

76: ‘3_weeks_post’,

77: ‘3_weeks_prior’,

78: ‘6_weeks_prior’,

79: ‘3_weeks_prior’,

80: ‘9_weeks_prior’,

81: ‘3_weeks_post’,

82: ‘3_weeks_prior’,

83: ‘9_weeks_prior’,

84: ‘6_weeks_prior’,

85: ‘9_weeks_post’,

86: ‘6_weeks_post’,

87: ‘9_weeks_prior’,

88: ‘3_weeks_prior’,

89: ‘6_weeks_post’,

90: ‘6_weeks_prior’,

91: ‘3_weeks_post’,

92: ‘9_weeks_post’,

93: ‘6_weeks_prior’,

94: ‘9_weeks_post’,

95: ‘6_weeks_post’,

96: ‘3_weeks_prior’,

97: ‘3_weeks_post’,

98: ‘9_weeks_prior’,

99: ‘9_weeks_prior’,

100: ‘9_weeks_post’,

101: ‘6_weeks_post’,

102: ‘6_weeks_prior’,

103: ‘3_weeks_post’,

104: ‘3_weeks_prior’,

105: ‘3_weeks_prior’,

106: ‘9_weeks_post’,

107: ‘9_weeks_prior’,

108: ‘6_weeks_prior’,

109: ‘3_weeks_post’,

110: ‘6_weeks_post’,

111: ‘3_weeks_prior’,

112: ‘9_weeks_post’,

113: ‘9_weeks_prior’,

114: ‘6_weeks_post’,

115: ‘6_weeks_prior’,

116: ‘3_weeks_post’,

117: ‘6_weeks_prior’,

118: ‘9_weeks_prior’,

119: ‘6_weeks_post’,

120: ‘9_weeks_post’,

121: ‘3_weeks_post’,

122: ‘3_weeks_prior’,

123: ‘6_weeks_post’,

124: ‘6_weeks_prior’,

125: ‘3_weeks_post’,

126: ‘3_weeks_prior’,

127: ‘9_weeks_prior’,

128: ‘9_weeks_post’},

‘attr_a’: {0: 0.0182370820668693,

1: 0.1010719754977029,

2: 0.16547497446373849,

3: 0.088669950738916245,

4: 0.086330935251798566,

5: 0.11612903225806449,

6: 0.086330935251798566,

7: 0.085714285714285715,

8: 0.029999999999999999,

9: 0.085714285714285715,

10: 0.0,

11: 0.084507042253521125,

12: 0.0,

13: 0.0,

14: 0.21531100478468901,

15: 0.016981132075471701,

16: 0.017341040462427751,

17: 0.067796610169491525,

18: 0.083487940630797772,

19: 0.01714285714285714,

20: 0.067988668555240786,

21: 0.090909090909090912,

22: 0.071428571428571425,

23: 0.17964071856287431,

24: 0.1076233183856502,

25: 0.1076233183856502,

26: 0.074999999999999997,

27: 0.2105263157894737,

28: 0.26785714285714279,

29: 0.052631578947368418,

30: 0.27108433734939757,

31: 0.052631578947368418,

32: 0.36842105263157893,

33: 0.034482758620689648,

34: 0.034482758620689648,

35: 0.034482758620689648,

36: 0.068571428571428575,

37: 0.18435754189944131,

38: 0.1359773371104816,

39: 0.078947368421052641,

40: 0.0,

41: 0.0,

42: 0.041095890410958909,

43: 0.0,

44: 0.039735099337748339,

45: 0.10000000000000001,

46: 0.1417322834645669,

47: 0.042857142857142858,

48: 0.042857142857142858,

49: 0.042857142857142858,

50: 0.028846153846153851,

51: 0.085051546391752567,

52: 0.16195372750642681,

53: 0.31619537275064269,

54: 0.0439453125,

55: 0.0086705202312138737,

56: 0.059829059829059832,

57: 0.03503649635036496,

58: 0.094285714285714278,

59: 0.15517241379310351,

60: 0.1198003327787022,

61: 0.10606060606060611,

62: 0.038314176245210732,

63: 0.038314176245210732,

64: 0.038363171355498722,

65: 0.098984771573604052,

66: 0.046332046332046337,

67: 0.0,

68: 0.0,

69: 0.0,

70: 0.048000000000000001,

71: 0.0,

72: 0.017182130584192441,

73: 0.017182130584192441,

74: 0.1003717472118959,

75: 0.049861495844875349,

76: 0.017341040462427751,

77: 0.01666666666666667,

78: 0.099447513812154692,

79: 0.032608695652173912,

80: 0.19926199261992619,

81: 0.020242914979757089,

82: 0.021186440677966101,

83: 0.0439453125,

84: 0.02178649237472767,

85: 0.020242914979757089,

86: 0.020242914979757089,

87: 0.43984962406015038,

88: 0.035714285714285712,

89: 0.07792207792207792,

90: 0.16949152542372881,

91: 0.036585365853658541,

92: 0.079295154185022032,

93: 0.1061946902654867,

94: 0.05281690140845071,

95: 0.05281690140845071,

96: 0.052325581395348833,

97: 0.017441860465116279,

98: 0.15728155339805819,

99: 0.045454545454545463,

100: 0.0,

101: 0.0,

102: 0.045454545454545463,

103: 0.0,

104: 0.0,

105: 0.01973684210526316,

106: 0.060133630289532287,

107: 0.079120879120879117,

108: 0.039473684210526321,

109: 0.0,

110: 0.040000000000000001,

111: 0.14457831325301199,

112: 0.34449760765550241,

113: 0.32270916334661348,

114: 0.33750000000000002,

115: 0.28742514970059879,

116: 0.14814814814814811,

117: 0.0,

118: 0.0,

119: 0.060975609756097567,

120: 0.060975609756097567,

121: 0.058823529411764712,

122: 0.0,

123: 0.079207920792079209,

124: 0.1584905660377359,

125: 0.079207920792079209,

126: 0.067669172932330823,

127: 0.40198511166253098,

128: 0.079207920792079209}}

spanner_df = pd.DataFrame(inputof)

mdu_list_of = list(spanner_df[‘attr_z’].value_counts().index)

range_of = list(spanner_df[‘source’].value_counts().index)

range_of_mass = spanner_df[[‘source’, ‘m_sorting’]].drop_duplicates()

range_of_mass.sort_values(by=‘m_sorting’, inplace=True)

range_of = list(range_of_mass[‘source’])

final_list =

output_file(“x_mdu_plot.html”)

for mdu in mdu_list_of:

source_of = ColumnDataSource(spanner_df[spanner_df['attr_z'] == mdu])
p = figure(plot_height = 500, plot_width = 900,
        title="_ " + mdu + " details",
        x_axis_label="Periods of data",
        y_axis_label="attr_a",
        x_range=range_of,
        y_range=(0, spanner_df[spanner_df['attr_z'] == mdu]['attr_a'].max()))
p.vbar(x='source',
        top='attr_a',
        bottom=0, width=0.5, fill_color='actual_color',
        line_color=None,
        source=source_of)
p.extra_y_ranges = {"foo": Range1d(start=0, end=10)}
p.add_layout(LinearAxis(y_range_name="foo", axis_label="Number of areas", axis_line_dash='dotted'), 'right')
p.circle('source',
        'size', color='black',
        y_range_name="foo",
        legend='# of weeks of data in period',
        #line_dash='dotted',
        line_color='black',
        fill_alpha=0.1,
        radius=0.03,
        source=source_of)
p.legend.location = "top_left"
p.legend.background_fill_alpha = 0.1
p.yaxis[0].formatter = NumeralTickFormatter(format="0.0%")
final_list.append(p)

final = gridplot([ for x in final_list])

show(final)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3c2537a8-b9dd-4df3-85bb-46474f0e1561%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hey Jared,
Im facing the same problem, as my project’s output includes up to 150 simple plots. It takes up to 3 minutes to load.

I wonder if the solution suggested here helped you, or if you’ve found any other way.

Thanks in advance.

···

On Wednesday, September 6, 2017 at 5:53:25 PM UTC+3, Jared Thompson wrote:

Bryan, thanks for the context you provided to look at the problem and for the ideas. I will try those out.
Thank you for taking the time.

On Wednesday, September 6, 2017 at 10:33:00 AM UTC-4, Bryan Van de ven wrote:

Running the code it looks like there are ~25 plots. Bokeh is definitely tilted towards a certain feature set that make it less desirable for “more, simpler plots”. Which isn’t to say things can’t be improved more in that direction, but that’s the case currently. That said, my offhand guess as to what is taking so long (FYI it takes about 3-4 seconds to render on my 2016 MBP) is the layout constraint computation. That happens because all the plots are in a single Bokeh layout layout model (GridPlot in this case). An experiment to try would be to not use a grid plot. Instead, use bokeh.embed.components to embed each plot individually into a template. Then, the layouts of the individual plots will not be coupled together, which may speed up the load time.

Thanks,

Bryan

On Sep 6, 2017, at 08:44, [email protected] wrote:

I have pared my example down to a minimal example (the data is small but still takes up a lot of vertical room). What I am experiencing is about 10 seconds of render time.

I am trying to figure out if that is an expected length of time or if I have done something glaringly wrong/inefficient in my generation of the plots.

The rendering was taking about 30 seconds, then I sorted the data and now it is down to about 8-10 seconds on a three different machines. That time is consistent when doing ctrl+shift+r to refresh the page and have it loaded again.

Bokeh version: 12.7

I have never had this kind of slowness before, but this is my first time using the gridplot and have been trying different methods for a few days - finally I thought to post here to see if this is the expected render time for plots arranged like this.

Here is the script:

import pandas as pd

from bokeh.plotting import figure, show, output_file

from bokeh.models import LinearAxis, Range1d, ColumnDataSource, NumeralTickFormatter

from bokeh.layouts import gridplot

inputof = {‘attr_z’: {0: ‘TYPE_A’,

1: ‘TYPE_A’,

2: ‘TYPE_A’,

3: ‘TYPE_B’,

4: ‘TYPE_B’,

5: ‘TYPE_B’,

6: ‘TYPE_B’,

7: ‘TYPE_B’,

8: ‘TYPE_B’,

9: ‘TYPE_C’,

10: ‘TYPE_C’,

11: ‘TYPE_C’,

12: ‘TYPE_C’,

13: ‘TYPE_C’,

14: ‘TYPE_C’,

15: ‘TYPE_Z’,

16: ‘TYPE_Z’,

17: ‘TYPE_Z’,

18: ‘TYPE_Z’,

19: ‘TYPE_Z’,

20: ‘TYPE_Z’,

21: ‘TYPE_D’,

22: ‘TYPE_D’,

23: ‘TYPE_D’,

24: ‘TYPE_D’,

25: ‘TYPE_D’,

26: ‘TYPE_D’,

27: ‘TYPE_FF’,

28: ‘TYPE_FF’,

29: ‘TYPE_FF’,

30: ‘TYPE_FF’,

31: ‘TYPE_FF’,

32: ‘TYPE_FF’,

33: ‘TYPE_E’,

34: ‘TYPE_E’,

35: ‘TYPE_E’,

36: ‘TYPE_E’,

37: ‘TYPE_E’,

38: ‘TYPE_E’,

39: ‘TYPE_F’,

40: ‘TYPE_F’,

41: ‘TYPE_F’,

42: ‘TYPE_F’,

43: ‘TYPE_F’,

44: ‘TYPE_F’,

45: ‘TYPE_G’,

46: ‘TYPE_G’,

47: ‘TYPE_G’,

48: ‘TYPE_G’,

49: ‘TYPE_G’,

50: ‘TYPE_G’,

51: ‘TYPE_H’,

52: ‘TYPE_H’,

53: ‘TYPE_H’,

54: ‘TYPE_I’,

55: ‘TYPE_I’,

56: ‘TYPE_I’,

57: ‘TYPE_I’,

58: ‘TYPE_I’,

59: ‘TYPE_I’,

60: ‘TYPE_J’,

61: ‘TYPE_J’,

62: ‘TYPE_J’,

63: ‘TYPE_J’,

64: ‘TYPE_J’,

65: ‘TYPE_J’,

66: ‘TYPE_K’,

67: ‘TYPE_K’,

68: ‘TYPE_K’,

69: ‘TYPE_K’,

70: ‘TYPE_K’,

71: ‘TYPE_K’,

72: ‘TYPE_L’,

73: ‘TYPE_L’,

74: ‘TYPE_L’,

75: ‘TYPE_L’,

76: ‘TYPE_L’,

77: ‘TYPE_L’,

78: ‘TYPE_M’,

79: ‘TYPE_M’,

80: ‘TYPE_M’,

81: ‘TYPE_N’,

82: ‘TYPE_N’,

83: ‘TYPE_N’,

84: ‘TYPE_N’,

85: ‘TYPE_N’,

86: ‘TYPE_N’,

87: ‘TYPE_O’,

88: ‘TYPE_O’,

89: ‘TYPE_O’,

90: ‘TYPE_O’,

91: ‘TYPE_O’,

92: ‘TYPE_O’,

93: ‘TYPE_P’,

94: ‘TYPE_P’,

95: ‘TYPE_P’,

96: ‘TYPE_P’,

97: ‘TYPE_P’,

98: ‘TYPE_P’,

99: ‘TYPE_Q’,

100: ‘TYPE_Q’,

101: ‘TYPE_Q’,

102: ‘TYPE_Q’,

103: ‘TYPE_Q’,

104: ‘TYPE_Q’,

105: ‘TYPE_R’,

106: ‘TYPE_R’,

107: ‘TYPE_R’,

108: ‘TYPE_R’,

109: ‘TYPE_R’,

110: ‘TYPE_R’,

111: ‘TYPE_S’,

112: ‘TYPE_S’,

113: ‘TYPE_S’,

114: ‘TYPE_S’,

115: ‘TYPE_S’,

116: ‘TYPE_S’,

117: ‘TYPE_T’,

118: ‘TYPE_T’,

119: ‘TYPE_T’,

120: ‘TYPE_T’,

121: ‘TYPE_T’,

122: ‘TYPE_T’,

123: ‘TYPE_U’,

124: ‘TYPE_U’,

125: ‘TYPE_U’,

126: ‘TYPE_U’,

127: ‘TYPE_U’,

128: ‘TYPE_U’},

‘actual_color’: {0: ‘#58D68D’,

1: ‘#F5B041’,

2: ‘#D7DF01’,

3: ‘#F5B041’,

4: ‘#F5B041’,

5: ‘#D7DF01’,

6: ‘#D7DF01’,

7: ‘#58D68D’,

8: ‘#58D68D’,

9: ‘#F5B041’,

10: ‘#D7DF01’,

11: ‘#58D68D’,

12: ‘#F5B041’,

13: ‘#58D68D’,

14: ‘#D7DF01’,

15: ‘#D7DF01’,

16: ‘#58D68D’,

17: ‘#58D68D’,

18: ‘#D7DF01’,

19: ‘#F5B041’,

20: ‘#F5B041’,

21: ‘#F5B041’,

22: ‘#58D68D’,

23: ‘#D7DF01’,

24: ‘#F5B041’,

25: ‘#D7DF01’,

26: ‘#58D68D’,

27: ‘#F5B041’,

28: ‘#F5B041’,

29: ‘#58D68D’,

30: ‘#D7DF01’,

31: ‘#58D68D’,

32: ‘#D7DF01’,

33: ‘#D7DF01’,

34: ‘#F5B041’,

35: ‘#58D68D’,

36: ‘#58D68D’,

37: ‘#D7DF01’,

38: ‘#F5B041’,

39: ‘#D7DF01’,

40: ‘#D7DF01’,

41: ‘#58D68D’,

42: ‘#58D68D’,

43: ‘#F5B041’,

44: ‘#F5B041’,

45: ‘#F5B041’,

46: ‘#D7DF01’,

47: ‘#F5B041’,

48: ‘#D7DF01’,

49: ‘#58D68D’,

50: ‘#58D68D’,

51: ‘#58D68D’,

52: ‘#F5B041’,

53: ‘#D7DF01’,

54: ‘#D7DF01’,

55: ‘#58D68D’,

56: ‘#58D68D’,

57: ‘#F5B041’,

58: ‘#F5B041’,

59: ‘#D7DF01’,

60: ‘#D7DF01’,

61: ‘#F5B041’,

62: ‘#D7DF01’,

63: ‘#F5B041’,

64: ‘#58D68D’,

65: ‘#58D68D’,

66: ‘#F5B041’,

67: ‘#D7DF01’,

68: ‘#58D68D’,

69: ‘#F5B041’,

70: ‘#D7DF01’,

71: ‘#58D68D’,

72: ‘#D7DF01’,

73: ‘#F5B041’,

74: ‘#D7DF01’,

75: ‘#F5B041’,

76: ‘#58D68D’,

77: ‘#58D68D’,

78: ‘#F5B041’,

79: ‘#58D68D’,

80: ‘#D7DF01’,

81: ‘#58D68D’,

82: ‘#58D68D’,

83: ‘#D7DF01’,

84: ‘#F5B041’,

85: ‘#D7DF01’,

86: ‘#F5B041’,

87: ‘#D7DF01’,

88: ‘#58D68D’,

89: ‘#F5B041’,

90: ‘#F5B041’,

91: ‘#58D68D’,

92: ‘#D7DF01’,

93: ‘#F5B041’,

94: ‘#D7DF01’,

95: ‘#F5B041’,

96: ‘#58D68D’,

97: ‘#58D68D’,

98: ‘#D7DF01’,

99: ‘#D7DF01’,

100: ‘#D7DF01’,

101: ‘#F5B041’,

102: ‘#F5B041’,

103: ‘#58D68D’,

104: ‘#58D68D’,

105: ‘#58D68D’,

106: ‘#D7DF01’,

107: ‘#D7DF01’,

108: ‘#F5B041’,

109: ‘#58D68D’,

110: ‘#F5B041’,

111: ‘#58D68D’,

112: ‘#D7DF01’,

113: ‘#D7DF01’,

114: ‘#F5B041’,

115: ‘#F5B041’,

116: ‘#58D68D’,

117: ‘#F5B041’,

118: ‘#D7DF01’,

119: ‘#F5B041’,

120: ‘#D7DF01’,

121: ‘#58D68D’,

122: ‘#58D68D’,

123: ‘#F5B041’,

124: ‘#F5B041’,

125: ‘#58D68D’,

126: ‘#58D68D’,

127: ‘#D7DF01’,

128: ‘#D7DF01’},

‘m_color’: {0: 0,

1: 1,

2: 2,

3: 1,

4: 1,

5: 2,

6: 2,

7: 0,

8: 0,

9: 1,

10: 2,

11: 0,

12: 1,

13: 0,

14: 2,

15: 2,

16: 0,

17: 0,

18: 2,

19: 1,

20: 1,

21: 1,

22: 0,

23: 2,

24: 1,

25: 2,

26: 0,

27: 1,

28: 1,

29: 0,

30: 2,

31: 0,

32: 2,

33: 2,

34: 1,

35: 0,

36: 0,

37: 2,

38: 1,

39: 2,

40: 2,

41: 0,

42: 0,

43: 1,

44: 1,

45: 1,

46: 2,

47: 1,

48: 2,

49: 0,

50: 0,

51: 0,

52: 1,

53: 2,

54: 2,

55: 0,

56: 0,

57: 1,

58: 1,

59: 2,

60: 2,

61: 1,

62: 2,

63: 1,

64: 0,

65: 0,

66: 1,

67: 2,

68: 0,

69: 1,

70: 2,

71: 0,

72: 2,

73: 1,

74: 2,

75: 1,

76: 0,

77: 0,

78: 1,

79: 0,

80: 2,

81: 0,

82: 0,

83: 2,

84: 1,

85: 2,

86: 1,

87: 2,

88: 0,

89: 1,

90: 1,

91: 0,

92: 2,

93: 1,

94: 2,

95: 1,

96: 0,

97: 0,

98: 2,

99: 2,

100: 2,

101: 1,

102: 1,

103: 0,

104: 0,

105: 0,

106: 2,

107: 2,

108: 1,

109: 0,

110: 1,

111: 0,

112: 2,

113: 2,

114: 1,

115: 1,

116: 0,

117: 1,

118: 2,

119: 1,

120: 2,

121: 0,

122: 0,

123: 1,

124: 1,

125: 0,

126: 0,

127: 2,

128: 2},

‘m_sorting’: {0: 0,

1: 2,

2: 4,

3: 2,

4: 3,

5: 4,

6: 5,

7: 1,

8: 0,

9: 2,

10: 5,

11: 0,

12: 3,

13: 1,

14: 4,

15: 5,

16: 1,

17: 0,

18: 4,

19: 3,

20: 2,

21: 2,

22: 1,

23: 4,

24: 3,

25: 5,

26: 0,

27: 2,

28: 3,

29: 1,

30: 5,

31: 0,

32: 4,

33: 5,

34: 3,

35: 1,

36: 0,

37: 4,

38: 2,

39: 4,

40: 5,

41: 1,

42: 0,

43: 3,

44: 2,

45: 2,

46: 4,

47: 3,

48: 5,

49: 1,

50: 0,

51: 0,

52: 2,

53: 4,

54: 5,

55: 1,

56: 0,

57: 3,

58: 2,

59: 4,

60: 4,

61: 2,

62: 5,

63: 3,

64: 1,

65: 0,

66: 2,

67: 5,

68: 0,

69: 3,

70: 4,

71: 1,

72: 5,

73: 3,

74: 4,

75: 2,

76: 1,

77: 0,

78: 2,

79: 0,

80: 4,

81: 1,

82: 0,

83: 4,

84: 2,

85: 5,

86: 3,

87: 4,

88: 0,

89: 3,

90: 2,

91: 1,

92: 5,

93: 2,

94: 5,

95: 3,

96: 0,

97: 1,

98: 4,

99: 4,

100: 5,

101: 3,

102: 2,

103: 1,

104: 0,

105: 0,

106: 5,

107: 4,

108: 2,

109: 1,

110: 3,

111: 0,

112: 5,

113: 4,

114: 3,

115: 2,

116: 1,

117: 2,

118: 4,

119: 3,

120: 5,

121: 1,

122: 0,

123: 3,

124: 2,

125: 1,

126: 0,

127: 4,

128: 5},

‘size’: {0: 3,

1: 6,

2: 9,

3: 6,

4: 4,

5: 9,

6: 4,

7: 3,

8: 3,

9: 6,

10: 5,

11: 3,

12: 5,

13: 3,

14: 9,

15: 9,

16: 3,

17: 3,

18: 9,

19: 6,

20: 6,

21: 6,

22: 3,

23: 9,

24: 4,

25: 4,

26: 3,

27: 6,

28: 6,

29: 3,

30: 9,

31: 3,

32: 9,

33: 1,

34: 1,

35: 1,

36: 3,

37: 9,

38: 6,

39: 9,

40: 3,

41: 3,

42: 3,

43: 3,

44: 6,

45: 6,

46: 9,

47: 1,

48: 1,

49: 1,

50: 3,

51: 3,

52: 6,

53: 9,

54: 9,

55: 3,

56: 3,

57: 6,

58: 6,

59: 9,

60: 9,

61: 6,

62: 4,

63: 4,

64: 3,

65: 3,

66: 6,

67: 3,

68: 3,

69: 3,

70: 9,

71: 3,

72: 5,

73: 5,

74: 9,

75: 6,

76: 3,

77: 3,

78: 6,

79: 3,

80: 9,

81: 3,

82: 3,

83: 9,

84: 6,

85: 3,

86: 3,

87: 9,

88: 3,

89: 6,

90: 6,

91: 3,

92: 9,

93: 6,

94: 5,

95: 5,

96: 3,

97: 3,

98: 9,

99: 9,

100: 9,

101: 6,

102: 6,

103: 3,

104: 3,

105: 3,

106: 9,

107: 9,

108: 6,

109: 3,

110: 6,

111: 3,

112: 8,

113: 9,

114: 6,

115: 6,

116: 3,

117: 6,

118: 9,

119: 5,

120: 5,

121: 3,

122: 3,

123: 2,

124: 6,

125: 2,

126: 3,

127: 9,

128: 2},

‘source’: {0: ‘3_weeks_prior’,

1: ‘6_weeks_prior’,

2: ‘9_weeks_prior’,

3: ‘6_weeks_prior’,

4: ‘6_weeks_post’,

5: ‘9_weeks_prior’,

6: ‘9_weeks_post’,

7: ‘3_weeks_post’,

8: ‘3_weeks_prior’,

9: ‘6_weeks_prior’,

10: ‘9_weeks_post’,

11: ‘3_weeks_prior’,

12: ‘6_weeks_post’,

13: ‘3_weeks_post’,

14: ‘9_weeks_prior’,

15: ‘9_weeks_post’,

16: ‘3_weeks_post’,

17: ‘3_weeks_prior’,

18: ‘9_weeks_prior’,

19: ‘6_weeks_post’,

20: ‘6_weeks_prior’,

21: ‘6_weeks_prior’,

22: ‘3_weeks_post’,

23: ‘9_weeks_prior’,

24: ‘6_weeks_post’,

25: ‘9_weeks_post’,

26: ‘3_weeks_prior’,

27: ‘6_weeks_prior’,

28: ‘6_weeks_post’,

29: ‘3_weeks_post’,

30: ‘9_weeks_post’,

31: ‘3_weeks_prior’,

32: ‘9_weeks_prior’,

33: ‘9_weeks_post’,

34: ‘6_weeks_post’,

35: ‘3_weeks_post’,

36: ‘3_weeks_prior’,

37: ‘9_weeks_prior’,

38: ‘6_weeks_prior’,

39: ‘9_weeks_prior’,

40: ‘9_weeks_post’,

41: ‘3_weeks_post’,

42: ‘3_weeks_prior’,

43: ‘6_weeks_post’,

44: ‘6_weeks_prior’,

45: ‘6_weeks_prior’,

46: ‘9_weeks_prior’,

47: ‘6_weeks_post’,

48: ‘9_weeks_post’,

49: ‘3_weeks_post’,

50: ‘3_weeks_prior’,

51: ‘3_weeks_prior’,

52: ‘6_weeks_prior’,

53: ‘9_weeks_prior’,

54: ‘9_weeks_post’,

55: ‘3_weeks_post’,

56: ‘3_weeks_prior’,

57: ‘6_weeks_post’,

58: ‘6_weeks_prior’,

59: ‘9_weeks_prior’,

60: ‘9_weeks_prior’,

61: ‘6_weeks_prior’,

62: ‘9_weeks_post’,

63: ‘6_weeks_post’,

64: ‘3_weeks_post’,

65: ‘3_weeks_prior’,

66: ‘6_weeks_prior’,

67: ‘9_weeks_post’,

68: ‘3_weeks_prior’,

69: ‘6_weeks_post’,

70: ‘9_weeks_prior’,

71: ‘3_weeks_post’,

72: ‘9_weeks_post’,

73: ‘6_weeks_post’,

74: ‘9_weeks_prior’,

75: ‘6_weeks_prior’,

76: ‘3_weeks_post’,

77: ‘3_weeks_prior’,

78: ‘6_weeks_prior’,

79: ‘3_weeks_prior’,

80: ‘9_weeks_prior’,

81: ‘3_weeks_post’,

82: ‘3_weeks_prior’,

83: ‘9_weeks_prior’,

84: ‘6_weeks_prior’,

85: ‘9_weeks_post’,

86: ‘6_weeks_post’,

87: ‘9_weeks_prior’,

88: ‘3_weeks_prior’,

89: ‘6_weeks_post’,

90: ‘6_weeks_prior’,

91: ‘3_weeks_post’,

92: ‘9_weeks_post’,

93: ‘6_weeks_prior’,

94: ‘9_weeks_post’,

95: ‘6_weeks_post’,

96: ‘3_weeks_prior’,

97: ‘3_weeks_post’,

98: ‘9_weeks_prior’,

99: ‘9_weeks_prior’,

100: ‘9_weeks_post’,

101: ‘6_weeks_post’,

102: ‘6_weeks_prior’,

103: ‘3_weeks_post’,

104: ‘3_weeks_prior’,

105: ‘3_weeks_prior’,

106: ‘9_weeks_post’,

107: ‘9_weeks_prior’,

108: ‘6_weeks_prior’,

109: ‘3_weeks_post’,

110: ‘6_weeks_post’,

111: ‘3_weeks_prior’,

112: ‘9_weeks_post’,

113: ‘9_weeks_prior’,

114: ‘6_weeks_post’,

115: ‘6_weeks_prior’,

116: ‘3_weeks_post’,

117: ‘6_weeks_prior’,

118: ‘9_weeks_prior’,

119: ‘6_weeks_post’,

120: ‘9_weeks_post’,

121: ‘3_weeks_post’,

122: ‘3_weeks_prior’,

123: ‘6_weeks_post’,

124: ‘6_weeks_prior’,

125: ‘3_weeks_post’,

126: ‘3_weeks_prior’,

127: ‘9_weeks_prior’,

128: ‘9_weeks_post’},

‘attr_a’: {0: 0.0182370820668693,

1: 0.1010719754977029,

2: 0.16547497446373849,

3: 0.088669950738916245,

4: 0.086330935251798566,

5: 0.11612903225806449,

6: 0.086330935251798566,

7: 0.085714285714285715,

8: 0.029999999999999999,

9: 0.085714285714285715,

10: 0.0,

11: 0.084507042253521125,

12: 0.0,

13: 0.0,

14: 0.21531100478468901,

15: 0.016981132075471701,

16: 0.017341040462427751,

17: 0.067796610169491525,

18: 0.083487940630797772,

19: 0.01714285714285714,

20: 0.067988668555240786,

21: 0.090909090909090912,

22: 0.071428571428571425,

23: 0.17964071856287431,

24: 0.1076233183856502,

25: 0.1076233183856502,

26: 0.074999999999999997,

27: 0.2105263157894737,

28: 0.26785714285714279,

29: 0.052631578947368418,

30: 0.27108433734939757,

31: 0.052631578947368418,

32: 0.36842105263157893,

33: 0.034482758620689648,

34: 0.034482758620689648,

35: 0.034482758620689648,

36: 0.068571428571428575,

37: 0.18435754189944131,

38: 0.1359773371104816,

39: 0.078947368421052641,

40: 0.0,

41: 0.0,

42: 0.041095890410958909,

43: 0.0,

44: 0.039735099337748339,

45: 0.10000000000000001,

46: 0.1417322834645669,

47: 0.042857142857142858,

48: 0.042857142857142858,

49: 0.042857142857142858,

50: 0.028846153846153851,

51: 0.085051546391752567,

52: 0.16195372750642681,

53: 0.31619537275064269,

54: 0.0439453125,

55: 0.0086705202312138737,

56: 0.059829059829059832,

57: 0.03503649635036496,

58: 0.094285714285714278,

59: 0.15517241379310351,

60: 0.1198003327787022,

61: 0.10606060606060611,

62: 0.038314176245210732,

63: 0.038314176245210732,

64: 0.038363171355498722,

65: 0.098984771573604052,

66: 0.046332046332046337,

67: 0.0,

68: 0.0,

69: 0.0,

70: 0.048000000000000001,

71: 0.0,

72: 0.017182130584192441,

73: 0.017182130584192441,

74: 0.1003717472118959,

75: 0.049861495844875349,

76: 0.017341040462427751,

77: 0.01666666666666667,

78: 0.099447513812154692,

79: 0.032608695652173912,

80: 0.19926199261992619,

81: 0.020242914979757089,

82: 0.021186440677966101,

83: 0.0439453125,

84: 0.02178649237472767,

85: 0.020242914979757089,

86: 0.020242914979757089,

87: 0.43984962406015038,

88: 0.035714285714285712,

89: 0.07792207792207792,

90: 0.16949152542372881,

91: 0.036585365853658541,

92: 0.079295154185022032,

93: 0.1061946902654867,

94: 0.05281690140845071,

95: 0.05281690140845071,

96: 0.052325581395348833,

97: 0.017441860465116279,

98: 0.15728155339805819,

99: 0.045454545454545463,

100: 0.0,

101: 0.0,

102: 0.045454545454545463,

103: 0.0,

104: 0.0,

105: 0.01973684210526316,

106: 0.060133630289532287,

107: 0.079120879120879117,

108: 0.039473684210526321,

109: 0.0,

110: 0.040000000000000001,

111: 0.14457831325301199,

112: 0.34449760765550241,

113: 0.32270916334661348,

114: 0.33750000000000002,

115: 0.28742514970059879,

116: 0.14814814814814811,

117: 0.0,

118: 0.0,

119: 0.060975609756097567,

120: 0.060975609756097567,

121: 0.058823529411764712,

122: 0.0,

123: 0.079207920792079209,

124: 0.1584905660377359,

125: 0.079207920792079209,

126: 0.067669172932330823,

127: 0.40198511166253098,

128: 0.079207920792079209}}

spanner_df = pd.DataFrame(inputof)

mdu_list_of = list(spanner_df[‘attr_z’].value_counts().index)

range_of = list(spanner_df[‘source’].value_counts().index)

range_of_mass = spanner_df[[‘source’, ‘m_sorting’]].drop_duplicates()

range_of_mass.sort_values(by=‘m_sorting’, inplace=True)

range_of = list(range_of_mass[‘source’])

final_list =

output_file(“x_mdu_plot.html”)

for mdu in mdu_list_of:

source_of = ColumnDataSource(spanner_df[spanner_df['attr_z'] == mdu])
p = figure(plot_height = 500, plot_width = 900,
        title="_ " + mdu + " details",
        x_axis_label="Periods of data",
        y_axis_label="attr_a",
        x_range=range_of,
        y_range=(0, spanner_df[spanner_df['attr_z'] == mdu]['attr_a'].max()))
p.vbar(x='source',
        top='attr_a',
        bottom=0, width=0.5, fill_color='actual_color',
        line_color=None,
        source=source_of)
p.extra_y_ranges = {"foo": Range1d(start=0, end=10)}
p.add_layout(LinearAxis(y_range_name="foo", axis_label="Number of areas", axis_line_dash='dotted'), 'right')
p.circle('source',
        'size', color='black',
        y_range_name="foo",
        legend='# of weeks of data in period',
        #line_dash='dotted',
        line_color='black',
        fill_alpha=0.1,
        radius=0.03,
        source=source_of)
p.legend.location = "top_left"
p.legend.background_fill_alpha = 0.1
p.yaxis[0].formatter = NumeralTickFormatter(format="0.0%")
final_list.append(p)

final = gridplot([ for x in final_list])

show(final)


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3c2537a8-b9dd-4df3-85bb-46474f0e1561%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Uri, I actually ended up taking a separate route. I found out that my users did not value the interactivity. As a result I just used:

from multiprocessing.dummy import Pool as ThreadPool

to generate the plots faster and exported them as png’s along with an html library to build a page with them in it. Then I just served that page.

···

On Fri, Nov 17, 2017 at 3:01 AM Uri Dar [email protected] wrote:

Hey Jared,
Im facing the same problem, as my project’s output includes up to 150 simple plots. It takes up to 3 minutes to load.

I wonder if the solution suggested here helped you, or if you’ve found any other way.

Thanks in advance.

Hi,

···

On Fri, Nov 17, 2017 at 12:51 PM, jared [email protected] wrote:

On Fri, Nov 17, 2017 at 3:01 AM Uri Dar [email protected] wrote:

Hey Jared,
Im facing the same problem, as my project’s output includes up to 150 simple plots. It takes up to 3 minutes to load.

I wonder if the solution suggested here helped you, or if you’ve found any other way.

Thanks in advance.

Uri, I actually ended up taking a separate route. I found out that my users did not value the interactivity. As a result I just used:

from multiprocessing.dummy import Pool as ThreadPool

to generate the plots faster and exported them as png’s along with an html library to build a page with them in it. Then I just served that page.

that’s a reasonable approach. If users don’t value those features, and it’s likely that with tens or hundreds of plots they won’t, then there is no point in carrying around extra baggage. However, on top of having plots many static plots, one can allow to click on each and redirect to its interactive, bokeh version, getting the best of this use case.

Obviously we are interested in improving bokeh’s performance. Upcoming 0.12.11 release will see multiple plot rendering time reduced by half (give or take), and there’s a lot that can be improved in future.

Mateusz

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CADss3AQNV5wO9uYHBEEKax%2BNF_41E35qC7CkkZ5%3D9LgMecMW2A%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

This is a great idea, wow. Thats what im going to do. Thank both of you very much!
I still use 0.12.5 so I will also upgrade.

Thanks

Uri

···

On Fri, Nov 17, 2017 at 5:26 PM, Mateusz Paprocki [email protected] wrote:

Hi,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CANFzp8h8BJy%3DOmYHbJZCCXHzcQoUdANxWYyhqtnXrqDdWKSx%2Bw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

On Fri, Nov 17, 2017 at 12:51 PM, jared [email protected] wrote:

On Fri, Nov 17, 2017 at 3:01 AM Uri Dar [email protected] wrote:

Hey Jared,
Im facing the same problem, as my project’s output includes up to 150 simple plots. It takes up to 3 minutes to load.

I wonder if the solution suggested here helped you, or if you’ve found any other way.

Thanks in advance.

Uri, I actually ended up taking a separate route. I found out that my users did not value the interactivity. As a result I just used:

from multiprocessing.dummy import Pool as ThreadPool

to generate the plots faster and exported them as png’s along with an html library to build a page with them in it. Then I just served that page.

that’s a reasonable approach. If users don’t value those features, and it’s likely that with tens or hundreds of plots they won’t, then there is no point in carrying around extra baggage. However, on top of having plots many static plots, one can allow to click on each and redirect to its interactive, bokeh version, getting the best of this use case.

Obviously we are interested in improving bokeh’s performance. Upcoming 0.12.11 release will see multiple plot rendering time reduced by half (give or take), and there’s a lot that can be improved in future.

Mateusz

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CADss3AQNV5wO9uYHBEEKax%2BNF_41E35qC7CkkZ5%3D9LgMecMW2A%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.