subplot

matplotlib - pandas - No xlabel and xticks for twinx axes in subploted figures

十年热恋 提交于 2019-12-01 21:05:56
问题 I had a similar question, which was answered previously. However, it differs in usage of Pandas package with it. Here is my previous question: matplotlib - No xlabel and xticks for twinx axes in subploted figures So, my question like last one is that why it does not show xlabel and xticks for first row diagrams when using this Python code. Two notes: I also used subplots instead of gridspec but same result. If you uncomment any of the commented lines in this code, which is related to using

matplotlib - pandas - No xlabel and xticks for twinx axes in subploted figures

ⅰ亾dé卋堺 提交于 2019-12-01 20:47:55
I had a similar question, which was answered previously. However, it differs in usage of Pandas package with it. Here is my previous question: matplotlib - No xlabel and xticks for twinx axes in subploted figures So, my question like last one is that why it does not show xlabel and xticks for first row diagrams when using this Python code. Two notes: I also used subplots instead of gridspec but same result. If you uncomment any of the commented lines in this code, which is related to using the Pandas on the axes in each diagram, the xlabel and xticks will disappear! import matplotlib.pyplot as

Looping through a function to plot several subplots, Python

扶醉桌前 提交于 2019-12-01 14:58:07
I have variables x and y def function(a,b): x = x[(x>a)*(x<b)] y = y[(y<a)*(y>b)] # perform some fitting routine using curve_fit on x and y fig = plt.figure() ax = fig.add_subplot(111) phist,xedge,yedge,img = ax.hist2d(x,y,bins=20,norm=LogNorm()) im = ax.imshow(phist,cmap=plt.cm.jet,norm=LogNorm(),aspect='auto') fig.colorbar(im,ax=ax) fig.show() All works fine. But I have 6 pairs of different input parameters a and b . I would like to somehow call function(a,b) using a loop and plot the six different x and y (corresponding to the 6 input pairs) as 6 subplots. like we do ax1 = fig.add_subplot

Tight subplot with colorbars and subplot's 3rd parameter in Matlab?

旧街凉风 提交于 2019-12-01 14:58:06
I would like to have a tight subplot i.e. minimum spacing between figures in the subplot where you have subplot's 3rd parameter i.e. you can decide where the picture is going to be i.e. easy to move between subplot and new_tight_subplot , and you can use it with colorbars. I have profiled the most popular tight subplots in FileExchange of Matlab. None (etc most popular here Pekka's version) can pass the following code data=randi(513,513); ax1=subplot(2,1,1); plot(mat2gray(pdist(data, 'correlation'))); cbar1=colorbar(ax1); axis(ax1, 'square'); xlim([0 size(mat2gray(pdist(data, 'correlation')),2

Getting text to display in front of subplot images

浪尽此生 提交于 2019-12-01 12:55:11
Ive got a lot of images of galaxies through different filters. each line of subplots represents a new object with a unique 'ID'. Im plotting all of these images using the subplot function but am having trouble adding the ID name. Ideally the ID would stretch in front of several subplots but at the moment it is placed behind (see picture). Does anyone know of a way to fix this? plt.close('all') ID=np.array([]) cata=csv.reader(open('final_final_list.csv',"rU")) for x in cata: ID=np.append(ID,x[0]) filterset=['ugr','i1','z','Y','J','H','Ks'] test2=np.array([]) for i in range(0,len(ID)): for j in

Why is subplot much faster than figure?

你离开我真会死。 提交于 2019-12-01 11:42:32
I'm building a data analysis platform in MATLAB. One of the system's features need to create many plots. At any given time only one plot is available and the user can traverse to the next/previous upon request (the emphasis here is that there is no need for multiple windows to be open). Initially I used the figure command each time a new plot was shown, but I noticed that, as the user traverse to the next plot, this command took a bit longer than I wanted. Degrading usability. So I tried using subplot instead and it worked much faster. Seeing this behavior I ran a little experiment, timing

Updating bar and plot subplots over loop iterations

自作多情 提交于 2019-12-01 10:49:47
I wrote the following snippet and I am trying to make it update the plots. What I get instead is an overlapping of new plots on the old ones. I researched a bit and found I needed relim() and autoscale_view(True,True,True) on the current axis. I still cannot get the desired behaviour. Is there a way to force pyplot to delete/remove the old drawing before calling plt.draw()? import numpy as np import matplotlib.pyplot as plt import time plt.ion() a = np.arange(10) fig,ax = plt.subplots(2,1) plt.show() for i in range(100): b = np.arange(10) * np.random.randint(10) ax[0].bar(a,b,align='center')

Why is subplot much faster than figure?

让人想犯罪 __ 提交于 2019-12-01 10:20:59
问题 I'm building a data analysis platform in MATLAB. One of the system's features need to create many plots. At any given time only one plot is available and the user can traverse to the next/previous upon request (the emphasis here is that there is no need for multiple windows to be open). Initially I used the figure command each time a new plot was shown, but I noticed that, as the user traverse to the next plot, this command took a bit longer than I wanted. Degrading usability. So I tried

how to remove “empty” space between subplots?

笑着哭i 提交于 2019-12-01 08:44:49
I'm making a figure with a total of 68 subplots and want to remove the empty space between them all. Here's what I have: . How would I go about doing this? EDIT: using plt.tight_layout() makes it even worse: Here's my code: for j in range(0,len(sort_yf)): for i in range(0,len(yf)): if yf[i]==sort_yf[j]: sort_ID=np.append(sort_ID,'output/'+ID[i]+'.png') for i in range (1,69): plt.subplot(17,4,i,aspect='equal') plots=img.imread(sort_ID[i]) plt.imshow(plots) plt.axis('off') plt.show() Have you tried the tight layout functionality? plt.tight_layout() See also HERE EDIT : Alternatively, you can use

Multiple titles (suptitle) with subplots

不羁的心 提交于 2019-12-01 08:42:19
I have a series of 9 subplots in a 3x3 grid, each subplot with a title. I want to add a title for each row. To do so I thought about using suptitle. The problem is if I use 3 suptitles they seems to be overwritten and only the last one seems to be shown. Here is my basic code: fig, axes = plt.subplots(3,3,sharex='col', sharey='row') for j in range(9): axes.flat[j].set_title('plot '+str(j)) plt1 = fig.suptitle("row 1",x=0.6,y=1.8,fontsize=18) plt2 = fig.suptitle("row 2",x=0.6,y=1.2,fontsize=18) plt3 = fig.suptitle("row 3",x=0.6,y=0.7,fontsize=18) fig.subplots_adjust(right=1.1,top=1.6) You can