How would you use matplotlib to show the outputs? I tried running the code with a simple plotting routine but there was no output since it shows the console window only. Am I missing something?
This is my code:
# import all necessary modules here import numpy as np import math import matplotlib.pyplot as plt # Variables for generating inputs and targets numSamples = 8 # number of sample points numDim = 1 # input dimensions # Generate Inputs and Targets here X = np.linspace(start=0, stop=2*math.pi, num=numSamples).reshape((numSamples,numDim)) ## Inputs Y_true = np.sin(X) # Targets plt.plot(X,Y_true) plt.xlabel("Inputs") plt.ylabel("Targets") plt.title("Ground Truth") plt.show()
Already have everything in place. Still dont get the plots when I run the code using Ctrl + Enter.
I have no problem with your code and got the following graph.
If you use Anaconda, maybe using "pythonw" instead of "python" may help you.
This file cannot be displayed: https://storage.googleapis.com/replit/images/1531988385901_dcbbc6e9c652e190950c597745891349.pn
Or, you can see my code using Matplotlib. As timmy_i_chen mentioned, in Repl, we cannot show the graph, but can save the graph using "plt.savefig("name_of_your_data.png")".