New to python and trying to teach myself the language. I understand the basics from R and SAS however I am still learning how to manipulate arrays and learn basic python in spyder.
I would really love your help with feed both x and y into a function f(x,y) (e.g sin(xy) for simplicity).
Typically in R, I would create a data frame by expanding values of x and y to create every combination (unique x and y per row) then run my these rows through my function and attach a new column in my dataframe, and plot the contour plot using lattice etc.
For the same function f(x,y) = z = sin(x,y), in python I have tried
x = np.linspace(0, 1, 100)
y = np.linspace(-1, 11, 100)
z= np.equ(x,y)
which obviously wouldnt work but I am unsure really how to do it.
This was attempted after trying to manipulate the following code from: Matplotlib line plot of x values against y:
import numpy as np
import matplotlib.pyplot as plt
fig,ax = plt.subplots(1)
# create some x data and some integers for the y axis
x = np.array([3,5,2,4])
y = np.arange(4)
# plot the data
ax.plot(x,y)
# tell matplotlib which yticks to plot
ax.set_yticks([0,1,2,3])
# labelling the yticks according to your list
ax.set_yticklabels(['A','B','C','D'])
Thank you for any help!