inline images have low quality

前端 未结 4 1951
悲&欢浪女
悲&欢浪女 2020-12-23 13:50

I\'m loading a TIF file with scikit-image and displaying it inline in an ipython notebook (version 2.2.0). This works, however, the image is quite small when first displaye

4条回答
  •  不思量自难忘°
    2020-12-23 14:13

    Assuming this is the same thing that happens with iPython notebook (with %matplotlib inline) when you go to drag and resize the image, the fix is fairly simple.

    If you just create a figure with a different default size, then the resolution also increases with the size of the default (Change resolution of imshow in ipython). For example:

    fig = plt.figure(figsize = (10,10))
    ax = fig.add_subplot(111)
    ax.imshow(array)
    

    Something like this should increase the resolution of the thing you are trying to plot. This seemed to work for me with your code:

    from skimage import io
    import matplotlib.pyplot as plt
    %matplotlib inline
    
    image_stack = io.MultiImage("my_image.tif")
    image = image_stack[0] 
    
    fig = plt.figure(figsize= (20,20)) #create an empty figure to plot into with 20x20 size
    io.imshow(image)
    io.show()
    

提交回复
热议问题