plot

Difficulties using matplotlib plot method

Difficulties using matplotlib plot method Question: Very recently I have been tasked with ploting a derivative using Python and matplotlib. This is my code: x=np.linspace(-100,100,num=50) funcion=(56*(x**3))-(38.999*(x**2))+(4.196*x-0.15) plt.plot(x, funcion) The resulting plot is this: Plot generated in Python At first sight, the graph looks okay, but is not correct, given that the graph is suposed to …

Total answers: 1

x and y must be the same size error python

x and y must be the same size error python Question: that’s what i need to find where the error is (. Make a scatter plot of Nsteps versus starting number. You should adjust your marker symbol and size such that you can discern patterns in the data, rather than just seeing a solid mass …

Total answers: 2

Plot nlargest is showing the inverse output

Plot nlargest is showing the inverse output Question: I am trying to plot the feature importance generated using random forest algorithm using the below code. However, the largest values are shown at the bottom. But I want them to be at the top. feat_importances = pd.Series(g_search.best_estimator_.feature_importances_, index=X_train.columns) feat_importances.nlargest(20).plot(kind=’barh’) You can see the graph below that …

Total answers: 1

ufunc 'sqrt' not supported for the input types

ufunc 'sqrt' not supported for the input types Question: Im trying to plot a scatter with values from my array, everything is working till im trying to scale the size of the dots with an value of my array. For example my array looks like this: [’50’, ‘ 50’, ‘ 0.6352952’] First value is x, …

Total answers: 1

How to plot with a for loop?

How to plot with a for loop? Question: I’m trying to use a for loop to plot several functions with Matplotlib in Python, a simplified version of my code is this: import matplotlib.pyplot as plt import numpy as np colors = ["r", "g", "b"] x = np.arange(0, 3, 1) for i in [3, 4, 6]: …

Total answers: 1

How do I add labels for a horizontal bar using matplotlib module?

How do I add labels for a horizontal bar using matplotlib module? Question: Since I am a newbie, please tell me how I should add labels for each bar toward the right. And it would be kind of you to explain the code too… Thank you. This is the dataframe that I have used: BG_donated …

Total answers: 2

matplotlib quiver() displaying double arrows

matplotlib quiver() displaying double arrows Question: The code below is producing double arrows. This is most noticeable in the center and along the bottom row. Am I missing something or is this a bug of some sort? The Googlebox has yielded nothing helpful. X = [[ 1, 1, 2, 3, 4, 5, 6, 7, 8, …

Total answers: 1

How do i filter by specific event for my graph plotting

How do i filter by specific event for my graph plotting Question: I have a CSV File with columns below: Time Event Speed 1/30/2022 17:23 Speeding 50 1/28/2022 18:22 Speeding 20 1/27/2022 22:00 Speeding 30 1/26/2022 23:23 Speeding 40 1/27/2022 22:00 Stopping 10 1/26/2022 23:23 Stopping 10 Issue: Currently my code will run and give …

Total answers: 1