Skip to content
Advertisement

Tag: imshow

Shrink/adjust the colorbar inside the plot

I am trying to shrink a colorbar, which is positioned inside the plot. When I position it outside of the plot (i. e. pad=0.05), it works just fine. Here’s a MWE: I have tried both shrink and fraction but none of them seem to do the trick. I am attaching the output. Any help is greatly appreciated! Answer Your basic

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

Adjusting gridlines and ticks in matplotlib imshow

I’m trying to plot a matrix of values and would like to add gridlines to make the boundary between values clearer. Unfortunately, imshow decided to locate the tick marks in the middle of each voxel. Is it possible to a) remove the ticks but leave the label in the same location and b) add gridlines between the pixel boundaries? Image

Removing white space around a saved image

I need to take an image and save it after some process. The figure looks fine when I display it, but after saving the figure, I got some white space around the saved image. I have tried the ‘tight’ option for savefig method, did not work either. The code: I am trying to draw a basic graph by using NetworkX

Advertisement