How to make hollow square tags with matplotlib in python

The black line in the following graph is constructed using the following command for matplotlib python

pylab.semilogy(xaxis, pq_averages, 'ks-',color='black', label='DCTCP-PQ47.5') 

So, the "ks-" part indicates a solid line with square black marks. Thus, he had solid squares for the constructed points. Can these squares be made hollow?

enter image description here

+18
python matplotlib
Jun 08 2018-12-12T00:
source share
2 answers

Try adding markerfacecolor as follows:

 pylab.semilogy(xaxis, pq_averages, 'ks-', markerfacecolor='none', label='DCTCP-PQ47.5') 
+30
Jun 08 '12 at 23:20
source share

Setting markerfacecolor='white' does not actually make them hollow, it makes them white. To make them hollow you need to set markerfacecolor='none' . In addition, you need to set markeredgecolor to the desired color. So:

 pylab.semilogy(xaxis, pq_averages, 'ks-',color='black', label='DCTCP-PQ47.5', markerfacecolor='none', markeredgecolor='black') 

Will do the job for you.

+9
Nov 17 '16 at 19:39
source share



All Articles