2

Suppose I have gridded data with dimensions (x,y) and values are in z. so simply we can make scatter plot for third dimension by:

import numpy as np
import matplotlib.pyplot as plt

x = np.random.random(10)
y = np.random.random(10)
z = np.random.random(10)
plt.scatter(x, y, c = z, s=150, cmap = 'jet')
plt.show()

[1]: https://i.sstatic.net/2acLp.png

what i am thinking now is to remove the line color of each circular scatter plot. And also instead of circle can we make it square??

I did not find any way to do that. your help will be highly appreciated.

0

1 Answer 1

9
  • Pass the argument edgecolors='none' to plt.scatter. The patch boundary will not be drawn.
  • Pass the argument marker='s' to plt.scatter. The marker style will be square.

Then, we have,

enter image description here


The source code,

import numpy as np
import matplotlib.pyplot as plt

x = np.random.random(10)
y = np.random.random(10)
z = np.random.random(10)
plt.scatter(x, y, c = z, s=150, cmap = 'jet', edgecolors='none', marker='s')
plt.show()  

Refer to matplotlib.pyplot.scatter for more information.

Sign up to request clarification or add additional context in comments.

1 Comment

Also note that in matplotlib 2.0.x, the default behaviour is to not plot the edges in scatter plots (and other objects)

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.