logo
down
shadow

Scatter plot in matplotlib not updating xlim and ylim


Scatter plot in matplotlib not updating xlim and ylim

By : user2948290
Date : November 14 2020, 04:48 PM
should help you out You can clear the figure, and open a new subplot, than the axes will be adjusted as you wanted.
code :
fig = plt.figure()
ax = fig.add_subplot(111)

x = [0, 4000, 8000, 100000]
y = [0, 10, 100, 150]
ax.scatter(x, y)

plt.clf()
ax = fig.add_subplot(111)

x = [0, 1, 2, 3]
y = x

ax.scatter(x, y)
plt.show()


Share : facebook icon twitter icon
How to set xlim and ylim for a subplot in matplotlib

How to set xlim and ylim for a subplot in matplotlib


By : Олег Жилинский
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You should learn a bit of the OO interface to matplotlib, not just the state machine interface. Almost all of the plt.* function are thin wrappers that basically do gca().*.
plt.subplot returns an axes object. Once you have a reference to the axes object you can plot directly to it, change its limits, etc.
code :
import matplotlib.pyplot as plt

ax1 = plt.subplot(131)
ax1.scatter([1, 2], [3, 4])
ax1.set_xlim([0, 5])
ax1.set_ylim([0, 5])


ax2 = plt.subplot(132)
ax2.scatter([1, 2],[3, 4])
ax2.set_xlim([0, 5])
ax2.set_ylim([0, 5])
import matplotlib.pyplot as plt

DATA_x = ([1, 2],
          [2, 3],
          [3, 4])

DATA_y = DATA_x[::-1]

XLIMS = [[0, 10]] * 3
YLIMS = [[0, 10]] * 3

for j, (x, y, xlim, ylim) in enumerate(zip(DATA_x, DATA_y, XLIMS, YLIMS)):
    ax = plt.subplot(1, 3, j + 1)
    ax.scatter(x, y)
    ax.set_xlim(xlim)
    ax.set_ylim(ylim)
Don't automatically adjust xlim, ylim for certain plot items in matplotlib

Don't automatically adjust xlim, ylim for certain plot items in matplotlib


By : Marco Behnke
Date : March 29 2020, 07:55 AM
Does that help You can turn autoscaling off using the state-machine(doc) or OO (doc) interfaces.
code :
ax = plt.gca()
ax.plot(arange(15))
plt.draw() # it will re-scale here
ax.autoscale(False)
ax.plot(arange(15) ** 2)
ax.draw() # will not rescale
Lazy Evaluation: Why can't I use plot(..., xlim = c(0,1), ylim = xlim)?

Lazy Evaluation: Why can't I use plot(..., xlim = c(0,1), ylim = xlim)?


By : Simon Achim
Date : March 29 2020, 07:55 AM
hope this fix your issue Quoting from the good manual:
code :
f <- function(x=4, y=x^2) {
    y
}
f() 
# [1] 16
f(y=x^2)
# Error in f(y = x^2) : object 'x' not found
Matplotlib ylim and xlim not working in combination of scatter plot and line plot or fill_between

Matplotlib ylim and xlim not working in combination of scatter plot and line plot or fill_between


By : Micheal Moore
Date : March 29 2020, 07:55 AM
I hope this helps you . In your code you are setting ax.set_xlim to equal (0,160).
All you have to do to make your code work is to get rid of the equal signs as shown below:
code :
ax.set_xlim(0,160)
ax.set_ylim(0,y_limit)  # no equals sign on these 2 lines
Set xlim, ylim on polar plot in Matplotlib

Set xlim, ylim on polar plot in Matplotlib


By : Nick
Date : March 29 2020, 07:55 AM
help you fix your problem I think you're on the right track with adjusting the overlap between plots. If you turn the grids back on, you can see that the plots are already bumping against each other in schematic0 and overlapping in schematic2. I'm not sure there's a better way to get rid of the white space than just messing with the subplots_adjust command like:
Related Posts Related Posts :
  • Looking for simplest option to render Razor cshtml pages in a console application without any web server
  • Evaluating variables at a specific time in Modelica
  • When I run the Application, only "web" engine is running in GlassFish. "webservices" is not started
  • How To Set MIME Type Of Google Drive File
  • Remove Missing Values in Weka
  • Reloading a UICollectionView using reloadData method returns immediately before reloading data
  • carrot2 - can I cluster documents from a folder?
  • StreamSocket has no Close Implementation in C#
  • Rails, Foundation 4, Respond.js not working properly in IE8
  • How can i create imagesurface from cairo xlib's Graphics Context using cairo and x11 Api's?
  • CKEditor "overflow: scroll" on parent causes toolbar to freeze at initial position
  • Differences between components and controls in ENYO
  • Photoshop making isometric?
  • Does Intel IPP 8.0 support in-place operations?
  • What is Object dictionary in CANOpen?
  • Example of orbBasic Indexed User Variables
  • convert to ABSOLUTE in logback
  • How to conditionally download file using p:fileDownload
  • Error on pod install
  • Set HTTP GET Parameters in Finagle
  • different attack that uses sql injection
  • How can I change my xampp username not as 'root'
  • AMQP Content header payload structure
  • Apache POI formula evaluation not working for Excel IF
  • How can I trace RESTEasy's dispatch?
  • Map Freezes on iOS 7 with Google Maps SDK 1.4
  • Comparing lists, is the subset list within the first list
  • Non-ascii character highlight in Sublime Text 2
  • Installing Magit in Aquamacs
  • Receiving error - System.Net.Mail.SmtpException: 4.3.2 try again later
  • Coreaudio render callback in monotouch
  • The command 'yarn --v' also initiates 'yarn install' and installs packages automatically. Why is this happening?
  • save multiple matches in a list (grep or awk)
  • Can a number register be used in a groff request?
  • Mapping FAQ with RASA for large dataset (2000+)
  • Fragment not receiving LiveData updates after remove + add
  • FitText.js makes text bigger rather than smaller
  • ARM - Implementing stack with load/store multiple register values
  • How to check if a ChromeCast Session is already in progress
  • ngForm inside a Carousel Slide in UI Bootstrap not working
  • Clearing attributes in Tritium
  • "vagrant up" failing: Vagrant VM failed to remain in the running state
  • ftsearch returning empty docs
  • What are the advantages of setting "hive.exec.parallel" to false in Hive ?
  • Creating a root certificate in FiddlerCore
  • How to access app.config in a blueprint?
  • DB2 RECORDSET table name converted to uppercase
  • Resizing the superview according to the subviews
  • IExpress - Disable Compression
  • Getting InvalidProtocolBufferException while running oozie job
  • What are the differences between Play run and start?
  • How can I share props in ReasonReact?
  • Task.Delay is skipped
  • Parsley.js Password Confirm doesn‘t work
  • How to get all registred 'browser:resource' in Plone
  • Overriding page_list controller inside a package in Concrete5.6.1.2
  • Robolectric 2.x - dependent jars are downloading while running the tests
  • Setting Flyout to Main Frame Navigation(Windows 8.1 app store)
  • Build project - Nuget Error
  • How to recover admin password for SonarQube
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org