Skip to content
Advertisement

Plotting different shape 2D arrays in matplotlib

I couldn’t find any answer to this specific case. Say I want to create a scatter plot from the following data:

JavaScript

Where all the values of y[0] are the correseponding values of X[0] (86) and so on. I know I can just use numpy repeat function but I thought maybe there’s any other more feasilbe option? I’ve tried to reshape the any of the arrays but it didn’t help. Any ideas?

Advertisement

Answer

I really like the tile function from numpy. I dont think there is a way around of “enlarging” X[i] to make it match the length of y[i]

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement