Im trying to replicate a chart the was done in AmCharts but so far Im confused in the way to make the legend be outside and at the bottom of the plot
right now im using this django view to render the plot
def my_view(request)
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
colors = ["#FF9800", "#00E676", "#03A9F4", "#1A237E", "#AD1457", "#F44336", "#1DE9B6", "#01579B", "#CFD8DC",
"#90A4AE", "#263238", "#B71C1C", "#FFEB3B"]
data=('serv1','Aplicaiones','serv3','serv4','servi5','serv1','serv2','serv3','serv4','servi5',)
datos=[99.3,99,23,100,99.3,99,23,100,99.3,99]
figure=plt.Figure()
pos=np.arange(len(datos))
ax = figure.add_subplot(111)
b=ax.bar(pos, datos,color=colors)
ax.legend(b,data,loc='upper center', bbox_to_anchor=(0,-.05, 1,0), ncol=5,mode="expand")
ax.axis('off') #
response = HttpResponse(content_type='image/png')
figure.bbox_inches='tight'
canvas = FigureCanvas(figure)
canvas.print_png(response)
return response
the parameter bbox_to_anchor looks like the way to go, but chart has a limit and the label ends too close to the bars, my goal is to put the label (1 for each bar) leave space for axis description
right now this is what I got https://d26dzxoao6i3hh.cloudfront.net/items/0l0v2P2N3h1M15022V43/Captura%20de%20pantalla%202017-10-23%20a%20la(s)%2023.47.05.png?v=a36b97c9