figure

Show only selected or specific matplotlib figures

北城余情 提交于 2021-01-27 02:27:22
问题 I am generating a total of 50+ figures but I do not wish to display them all. I would like to pick out the figures that I want to display. Is there any way to do it? For example: I have 50 plots which are generated over the course of the program. At the end, when I enter plt.show(), it shows all the figures. However, I would like to display only 3 or 4 figures (but they aren't fixed i.e, I could plot figures 1, 2, 3, 4 at one time and another time I could plot figures 10, 27, 33, 45). Also, a

Remove white border when using subplot and imshow in python (Matplotlib)

邮差的信 提交于 2021-01-22 04:24:59
问题 import numpy as np import sys import matplotlib as mpl import matplotlib.pyplot as plt i use the following code to save an image fig, ax = plt.subplots(frameon=False) ax.axis ('off') ax.imshow (array[:,:,0,0,0]) fig.savefig ("file.png", bbox_inches='tight') However, what I get is and this obviously still has a white border. How do I get rid of it? The array.shape is: (256, 256, 1, 1, 3) 回答1: Look at my example it may help you: import numpy as np import matplotlib.pyplot as plt def save_image

matplotlib - change figsize but keep fontsize constant

戏子无情 提交于 2021-01-04 05:56:57
问题 I want to display several figures with different sizes, making sure that the text has always the same size when the figures are printed. How can I achieve that? As an example. Let's say I have two figures: import matplotlib.pylab as plt import matplotlib as mpl mpl.rc('font', size=10) fig1 = plt.figure(figsize = (3,1)) plt.title('This is fig1') plt.plot(range(0,10),range(0,10)) plt.show() mpl.rc('font', size=?) fig2 = plt.figure(figsize = (20,10)) plt.title('This is fig2') plt.plot(range(0,10

matplotlib - change figsize but keep fontsize constant

蓝咒 提交于 2021-01-04 05:56:33
问题 I want to display several figures with different sizes, making sure that the text has always the same size when the figures are printed. How can I achieve that? As an example. Let's say I have two figures: import matplotlib.pylab as plt import matplotlib as mpl mpl.rc('font', size=10) fig1 = plt.figure(figsize = (3,1)) plt.title('This is fig1') plt.plot(range(0,10),range(0,10)) plt.show() mpl.rc('font', size=?) fig2 = plt.figure(figsize = (20,10)) plt.title('This is fig2') plt.plot(range(0,10

Setting figure size to be larger than screen size in matplotlib

非 Y 不嫁゛ 提交于 2021-01-03 17:01:20
问题 I'm trying to create figures in matplotlib that read nicely in a journal article. I have some larger figures (with subfigures) that I'd like to take up nearly an entire page in portrait mode (specifically, 6.5"x9" for a full-page figure with 1" margins on US letter paper). I can set the figure size easily with the figsize parameter. However, the figure is compressed if I set the figure size to be larger than my screen size (I'm working on a 13" laptop); specifically, the height is an issue.

Setting figure size to be larger than screen size in matplotlib

吃可爱长大的小学妹 提交于 2021-01-03 17:01:15
问题 I'm trying to create figures in matplotlib that read nicely in a journal article. I have some larger figures (with subfigures) that I'd like to take up nearly an entire page in portrait mode (specifically, 6.5"x9" for a full-page figure with 1" margins on US letter paper). I can set the figure size easily with the figsize parameter. However, the figure is compressed if I set the figure size to be larger than my screen size (I'm working on a 13" laptop); specifically, the height is an issue.

Setting figure size to be larger than screen size in matplotlib

霸气de小男生 提交于 2021-01-03 17:01:14
问题 I'm trying to create figures in matplotlib that read nicely in a journal article. I have some larger figures (with subfigures) that I'd like to take up nearly an entire page in portrait mode (specifically, 6.5"x9" for a full-page figure with 1" margins on US letter paper). I can set the figure size easily with the figsize parameter. However, the figure is compressed if I set the figure size to be larger than my screen size (I'm working on a 13" laptop); specifically, the height is an issue.

Setting figure size to be larger than screen size in matplotlib

本秂侑毒 提交于 2021-01-03 16:58:07
问题 I'm trying to create figures in matplotlib that read nicely in a journal article. I have some larger figures (with subfigures) that I'd like to take up nearly an entire page in portrait mode (specifically, 6.5"x9" for a full-page figure with 1" margins on US letter paper). I can set the figure size easily with the figsize parameter. However, the figure is compressed if I set the figure size to be larger than my screen size (I'm working on a 13" laptop); specifically, the height is an issue.