33

Black line in the following graph is plotting using the below command for matplotlib python

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

So 'ks-' part indicates solid line with square black marks. So it had solid squares for the plotted points. Can these squares be made hollow instead?

enter image description here

1
  • 3
    microseconds is typically one word :-) Commented Jun 8, 2012 at 23:20

2 Answers 2

53

Try adding markerfacecolor like so:

pylab.semilogy(xaxis, pq_averages, 'ks-', markerfacecolor='none', label='DCTCP-PQ47.5')
Sign up to request clarification or add additional context in comments.

6 Comments

Nice answer. Slightly improved would be to use markerfacecolor='none', but in general, your solution will be perfect 90% of the time.
@pelson: yes, that is better - I was not aware that 'none' was accepted as a color.
@HughBothwell, can you edit the answer to use markerfacecolor='none'?
In matplotlib 3.0.2, there is apparently no markerfacecolor. facecolor='none' does work.
For those who run out of space writing parameters for pyplot: markerfacecolor can be abbreviated mfc, there are also mec and even mew. See documentation.
|
14

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

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

Will do the job for you.

1 Comment

"Additionally, you need to set markerfacecolor to the color you want." You mean markeredgecolor here, right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.