Python Forum
How to plot implicit functions (with two variables) in scipy python using matplotlib?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to plot implicit functions (with two variables) in scipy python using matplotlib?
#2
xmin, xmax, ymin, ymax = xdata.min(), xdata.max(), ydata.min(), ydata.max()
g = lambda x, y: func1(res_lsq.x, x, y)**2
X, Y = np.meshgrid(np.linspace(xmin-0.2, xmax+0.2, 1000), np.linspace(ymin-0.2, ymax+0.2, 1000))
Z = g(X, Y)  # heavy computations.... 

# plotting the result 
plt.contourf(X, Y, np.log(Z), levels=[-10,-8])
plt.gca().scatter(xdata, ydata)
plt.colorbar()
plt.show()
Reply


Messages In This Thread
RE: How to plot implicit functions (with two variables) in scipy python using matplotlib? - by scidam - May-11-2019, 01:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Graphic line plot with matplotlib, text file in pytho khadija 2 1,375 Aug-15-2022, 12:00 PM
Last Post: khadija
  using variables with functions imported from different files. Scordomaniac 3 1,267 May-24-2022, 10:53 AM
Last Post: deanhystad
  Matplotlib Functions DaveG 1 1,254 Mar-13-2022, 04:49 AM
Last Post: Larz60+
  Plot 3 variables Menthix 3 2,109 Nov-13-2021, 02:47 PM
Last Post: Menthix
  plot on the same figure using a for loo with matplotlib drSlump 2 1,707 Oct-13-2021, 07:11 AM
Last Post: drSlump
  matplotlib, no plot when using Figure ajvperth 2 1,674 Oct-12-2021, 02:29 PM
Last Post: ajvperth
  Storing whole functions in variables dedesssse 3 2,087 Jul-29-2021, 09:17 PM
Last Post: deanhystad
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,220 Mar-11-2021, 10:52 AM
Last Post: buran
  Python Matplotlib: How do I plot lines with different end point in the same graph? JaneTan 0 1,575 Feb-28-2021, 11:56 AM
Last Post: JaneTan
  Getting parent variables in nested functions wallgraffiti 1 2,135 Jan-30-2021, 03:53 PM
Last Post: buran

Forum Jump:

User Panel Messages

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