Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrong dimension for my plot
#1
Hey guys,

I'm trying to plot something use np.linspace.
I wrote a function called
def snr():
and the output for example is
print(snr(0.25))=400
print(snr(0.50))=200
print(snr(0.75))=400

and now I want to plot this function

x = np.linspace(0.25 , 0.75, 1000)

ax1.plot(x, snr(x))

It tells me that my snr(x) has dimension 1. What should I change about my code?
Reply
#2
Quote:What should I change about my code?
It would be rather helpful if you show the code you would like to change.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Array dimension don't match asja2010 0 1,081 Feb-23-2023, 04:22 PM
Last Post: asja2010
  x and y must have same first dimension, but have shapes (1,) and (50,) asja2010 5 2,631 Jan-12-2023, 07:24 PM
Last Post: deanhystad
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,572 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  Strange error ValueError: dimension mismatch Anldra12 0 1,979 Aug-17-2021, 07:54 AM
Last Post: Anldra12
  ValueError: dimension mismatch Anldra12 0 3,404 Jul-17-2021, 04:46 PM
Last Post: Anldra12
  ValueError: x and y must have same first dimension, but have shapes (11,) and (15406, hobbyist 17 150,708 Mar-22-2021, 10:27 AM
Last Post: hobbyist
  How to plot intraday data of several days in one plot mistermister 3 2,923 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Error When Plotting ValueError: x and y must have same first dimension JoeDainton123 1 9,109 Oct-04-2020, 12:58 PM
Last Post: scidam
  python gives wrong string length and wrong character thienson30 2 3,013 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  How to plot vertically stacked plot with same x-axis and SriMekala 0 1,935 Jun-12-2019, 03:31 PM
Last Post: SriMekala

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020