Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Matplolib plot: Increase the size of data points

I am trying to plot the numpy arrays x_train and y_train. I am using matplotlib’s plot function and I would like to pass an argument to increase the size of the data points. Here is my code:

x_train = np.array([0.        , 0.10526316, 0.21052632, 0.31578947, 0.42105263,
       0.52631579, 0.63157895, 0.73684211, 0.84210526, 0.94736842,
       1.05263158, 1.15789474, 1.26315789, 1.36842105, 1.47368421,
       1.57894737, 1.68421053, 1.78947368, 1.89473684, 2.        ])

y_train = np.array([0.2260415, 0.08966768, -0.02649684, -0.1024971,   0.14580953, 
0.03593453, 0.14398569,  0.30298584,  0.51058752,  0.43602841,  0.50852418,
  1.05403315, 1.27155675,  1.38071476,  1.62995731,  1.6434204,   1.64367346,
  1.54763514, 1.47964281,  0.97544995])

plt.figure(figsize=(20,10))

plt.plot(x_train, y_train, '*', color='black', label='Train values with noise')

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use markersize (shortcut: ms):

plt.plot(x_train, y_train, '*', color='black', label='Train values with noise', ms=12)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading