Skip to content
Advertisement

Tag: matplotlib

IPython, “name ‘plt’ not defined”

I recently installed Atom as an IDE on my laptop, for university. I installed Hydrogen as a convenient solution to show some plots on the go. But whenever I run Hydrogen, I get this error: However Matplotlib is working properly when executed normally, and IPython seems to do as well. This is the code I’m trying to run test-wise: A

Stop showing plots in spyder

I have scripts that make lots of plots. I save them directly with plt.savefig() rather than plt.show() so I don’t have to close all the windows. In spyder, they all show up in the console if I use inline (meaning I have to scroll way back to see other output), and they all show up in separate windows if I

Add toolbar button icon matplotlib

I want to add an icon to a custom button in a matplotlib figure toolbar. How can I do that? So far, I have the following code: For now, the only thing that it does is adding a new button (which do what I want) but the icon is only the tool’s name i.e.: “newtool”. How can I change this

format/round numerical legend label in GeoPandas

I’m looking for a way to format/round the numerical legend labels in those maps produced by .plot() function in GeoPandas. For example: This gives me a legend with many decimal places: I want the legend label to be integers. Answer As I recently encountered the same issue, and a solution does not appear to be readily available on Stack Overflow

How to plot normalized histogram with pdf properly using matplotlib?

I try to plot normalized histogram using example from numpy.random.normal documentation. For this purpose I generate normally distributed random sample. Then I fitt normal distribution to the data and calculate pdf. Display fitted pdf and data histogram. I use density=True, but it is obviously, that pdf and histogram are not normalized. What can one suggests to plot truly normalized histogram

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid?

I am trying to understand how torchvision interacts with mathplotlib to produce a grid of images. It’s easy to generate images and display them iteratively: However, displaying these images in a grid does not seem to be as straightforward. Even though PyTorch’s documentation indicates that w is the correct shape, Python says that it isn’t. So I tried to permute

Advertisement