0

I am new to Python and I wanted to know if there was any way, using a library, to display such bars. Not necessarily with the colors or the percentage shown, but this idea of horizontal bars showing a level of progress.

I've tried the barh tool of matplotlib but it doesn't seem to be what I need, since I can only have a horizontal bar going to a certain value, but not the "empty" part (let's say if I have 60%, "empty" part would be the other 40%), plus it lacks of customization (hide the graph axis etc.)

Thanks in advance!

Tristan
  • 33
  • 1
  • 1
  • 4
  • I don't see this as being a duplicate of that question. I don't know of a way to natively do this, but you can always plot two bars to get the effect. Hmm, I tried to put code here, but I guess you can't in comments. – GeorgeLPerkins Jun 09 '18 at 23:18
  • Yeah it is a shame, it only answers a part of my question but not the main part... But thanks I think I understand what you mean, I would have loved an example of this but unfortunately... :/ – Tristan Jun 10 '18 at 07:46
  • Ernest has given you all the information you need. 1) Plot your values with [ax.barh](https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.barh.html) `ax.barh(categories, percentages, height = 0.6)` 2) Plot your 100% empty hull on top `ax.barh(categories, 100, height = 0.6, edgecolor = "black", linewidth = 5, fill = False)` 3) Remove axes etc. `plt.axis('off')` Done. – Mr. T Jun 10 '18 at 08:16
  • Thank you so much! You really helped me there! – Tristan Jun 10 '18 at 12:34

0 Answers0