subplot

Multiple titles (suptitle) with subplots

ぐ巨炮叔叔 提交于 2019-12-01 07:42:03
问题 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

Trying to add a 3d subplot to a matplotlib figure

对着背影说爱祢 提交于 2019-12-01 06:26:14
So I'm trying to create a figure that presents a 3d plot from data points, along with the plots 3 projections in 3 other subplots. I can add the subplots for the projections with no problems, but when I try to place the 3 dimensional plot into the figure things backfire. here's my code: def plotAll(data): fig = plt.figure() plot_3d = fig.add_subplot(221) ax = Axes3D(plot_3d) for i,traj in enumerate(data.values()): ax.plot3D([traj[0][-1]],[traj[1][-1]],[traj[2][-1]],".",color=[0.91,0.39,0.046]) #plot_12v13 = fig.add_subplot(222) #plot_projections(data,0,1) #plot_13v14 = fig.add_subplot(223)

Title over group of subplots

拈花ヽ惹草 提交于 2019-12-01 03:58:47
there are many subplots and each subplot has its own title. how can add a title over all of these group of subplots? I want this title to be shown at top center. x = linspace(-5,5); y1 = sin(x); subplot(2,5,[1:2]) plot(x,y1) title('y=sin(x)') y2 = cos(x); subplot(2,5,[3:4]) plot(x,y2) title('y=cos(x)') y3 = tan(x); subplot(2,5,[5,10]) plot(x,y3) title('y=tan(x)') y4 = sin(2*x); subplot(2,5,[6:7]) plot(x,y1) title('y=sin(2x)') y5 = cos(2*x); subplot(2,5,[8:9]) plot(x,y2) title('y=acos(2x)') Since Matlab 2018b, the new function sgtitle adds a title to a subplot group, simply add sgtitle('Subplot

Title over group of subplots

痞子三分冷 提交于 2019-12-01 00:24:05
问题 there are many subplots and each subplot has its own title. how can add a title over all of these group of subplots? I want this title to be shown at top center. x = linspace(-5,5); y1 = sin(x); subplot(2,5,[1:2]) plot(x,y1) title('y=sin(x)') y2 = cos(x); subplot(2,5,[3:4]) plot(x,y2) title('y=cos(x)') y3 = tan(x); subplot(2,5,[5,10]) plot(x,y3) title('y=tan(x)') y4 = sin(2*x); subplot(2,5,[6:7]) plot(x,y1) title('y=sin(2x)') y5 = cos(2*x); subplot(2,5,[8:9]) plot(x,y2) title('y=acos(2x)')

Matplotlib - Broken axis example: uneven subplot size

不问归期 提交于 2019-11-30 22:58:08
I haven't found a solution to adjust the height of the bottom and top plot of the broken axis example of matplotlib . BTW: The space between the two plots can be adjusted by: plt.subplots_adjust(hspace=0.03) UPDATE: I've almost figured it out using gridspec: """ Broken axis example, where the y-axis will have a portion cut out. """ import matplotlib.pylab as plt # NEW: import matplotlib.gridspec as gridspec import numpy as np pts = np.array([ 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, 0.109, 0.195,

Matplotlib odd subplots

牧云@^-^@ 提交于 2019-11-30 21:31:04
I have to plot a figure with 11 subpots as you can see below. But as it is an odd number, i dont know how to deal the subplot (4,3,12) to remove it... and place the 2 last plots on the center Moreover i would like to increse the subplot size as the space is too important. The code is below. The code is : plt.close() fig, axes = plt.subplots(nrows=4, ncols=3) plt.tight_layout(pad=0.05, w_pad=0.001, h_pad=2.0) ax1 = plt.subplot(431) # creates first axis ax1.set_xticks([]) ax1.set_yticks([]) ax1.tick_params(labelsize=8) i1 = ax1.imshow(IIIm,cmap='hot',extent=(0,2000,0,2000),vmin=-0.2,vmax=-0.1)

MATLAB: Plotting/Saving X-Y views of mesh function in subplots

狂风中的少年 提交于 2019-11-30 16:41:17
As the title says, I'm trying to save the 2-variable slices of a mesh function (as a .jpg, for example) as a subplot. I want to do this using a .m file because I have many plots to generate. I have figured out how to plot the views on their own figures, but I cannot get them to plot properly as subplots within a figure. To illustrate what I mean: Here are the outputs on individual plots: 3D mesh: 3D MATLAB mesh plot XY view: XY MATLAB mesh view YZ view: YZ MATLAB mesh view XZ view: XZ MATLAB mesh view And here is my plotting code (not working): %Ambiguity Surface fid = figure(fnum); axes1 =

Remove deadspace or increase size of figure in subplot

我的未来我决定 提交于 2019-11-30 15:50:18
问题 I have a problem in matlab. I output an image as shown in the example and save it by the print command. What I want to do is save the image in such a way that there is no deadspace i.e, I want to remove the white-space in the image saved. Example : The black border shows the total area the image is occupying. This is a really a wastage of space. I want to remove this. What I want to do is this: I have manually removed the white area around the image. But I want to do this automatically by the

Removing deadspace in subplots while retaining title & labels

不问归期 提交于 2019-11-30 15:40:00
问题 Hi I have a problem in matlab I want to create a figure containing 10 subplots. in 2X5 orientation. But the problem is that I want to reduce the deadspace area between them. I also require to keep the title, xlabel for the first row of images & the xlabel(only) for the second row of images. No ylabels are required. Till now I have done this code (for the first row): Once I figure the first row , the second row should be a piece of cake. close all figure,set(gca,'Color','none') subplot(2,5,1)

Removing deadspace in subplots while retaining title & labels

丶灬走出姿态 提交于 2019-11-30 15:05:45
Hi I have a problem in matlab I want to create a figure containing 10 subplots. in 2X5 orientation. But the problem is that I want to reduce the deadspace area between them. I also require to keep the title, xlabel for the first row of images & the xlabel(only) for the second row of images. No ylabels are required. Till now I have done this code (for the first row): Once I figure the first row , the second row should be a piece of cake. close all figure,set(gca,'Color','none') subplot(2,5,1);subplot('Position',[0.02 0.51 0.18 0.45]);get(gca,'position');set(gca, 'XTick', []);set(gca, 'YTick', [