figure

Indicating the statistically significant difference in bar graph

霸气de小男生 提交于 2019-11-27 00:38:41
问题 I use a bar graph to indicate the data of each group. Some of these bars differ significantly from each other. How can I indicate the significant difference in the bar plot? import numpy as np import matplotlib.pyplot as plt menMeans = (5, 15, 30, 40) menStd = (2, 3, 4, 5) ind = np.arange(4) # the x locations for the groups width=0.35 p1 = plt.bar(ind, menMeans, width=width, color='r', yerr=menStd) plt.xticks(ind+width/2., ('A', 'B', 'C', 'D') ) I am aiming for 回答1: I've done a couple of

Matlab: How to obtain all the axes handles in a figure handle?

房东的猫 提交于 2019-11-26 22:43:28
问题 How do I obtain all the axes handles in a figure handle? Given the figure handle hf , I found that get(hf, 'children') may return the handles of all axes. However, the Matlab Help suggests that it may return more than just the axes handles: Children of the figure . A vector containing the handles of all axes, user-interface objects displayed within the figure. You can change the order of the handles and thereby change the stacking of the objects on the display. Is there any way to obtain only

Python Matplotlib figure title overlaps axes label when using twiny

爷,独闯天下 提交于 2019-11-26 19:40:19
I am trying to plot two separate quantities on the same graph using twiny as follows: fig = figure() ax = fig.add_subplot(111) ax.plot(T, r, 'b-', T, R, 'r-', T, r_geo, 'g-') ax.set_yscale('log') ax.annotate('Approx. sea level', xy=(Planet.T_day*1.3,(Planet.R)/1000), xytext=(Planet.T_day*1.3, Planet.R/1000)) ax.annotate('Geostat. orbit', xy=(Planet.T_day*1.3, r_geo[0]), xytext=(Planet.T_day*1.3, r_geo[0])) ax.set_xlabel('Rotational period (hrs)') ax.set_ylabel('Orbital radius (km), logarithmic') ax.set_title('Orbital charts for ' + Planet.N, horizontalalignment='center', verticalalignment='top

Matplotlib - adding subplots to a subplot?

拜拜、爱过 提交于 2019-11-26 18:18:58
问题 I'm trying to create a figure that consists of a 2x2 grid, where in each quadrant there are 2 vertically stacked subplots (i.e. a 2x1 grid). I can't seem to figure out how to achieve this, though. The closest I've gotten is using gridspec and some ugly code (see below), but because gridspec.update(hspace=X) changes the spacing for all of the subplots I'm still not where I'd like to be. Ideally what I want is to, using the picture below as an example, decrease the spacing between the subplots

matlab: scatter plots with high number of datapoints

試著忘記壹切 提交于 2019-11-26 16:42:42
问题 I'm trying to plot scatter, something like: scatter(coor(:, 2), coor(:, 3), 1, coor(:, 4)); The problem is, that I have quite big number of coordinates to plot (~100 000). Its taking long time to plot it, and when I try to export figure to tiff - then matlab is dead for goooood few minutes... Any solution to improve plotting, or at least tiff export? EDIT: Forgot to mention, 3rd coordinate (coor(:, 4)) is a color code. So, when I'm using scatter (as above), I have something like on the image

How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?

╄→гoц情女王★ 提交于 2019-11-26 15:03:48
问题 I want to plot data, then create a new figure and plot data2, and finally come back to the original plot and plot data3, kinda like this: import numpy as np import matplotlib as plt x = arange(5) y = np.exp(5) plt.figure() plt.plot(x, y) z = np.sin(x) plt.figure() plt.plot(x, z) w = np.cos(x) plt.figure("""first figure""") # Here's the part I need plt.plot(x, w) FYI How do I tell matplotlib that I am done with a plot? does something similar, but not quite! It doesn't let me get access to that

How can I rotate a matplotlib plot through 90 degrees?

折月煮酒 提交于 2019-11-26 14:35:00
问题 I have created a figure in matplotlib which contains three subplots, one in the top left quadrant, one in the top right quadrant, and one in the bottom right quadrant. The top right figure contains a two-d image, and the other two plots are the projection onto the Y and X axis respectively. I'd like to rotate the top left quadrant subplot through 90deg counterclockwise, so that the x-axis of that plot lies along the y-axis of the 2-d plot. For the subplot, I realize I could flip the x and y

Error in plot.new() : figure margins too large, Scatter plot

别说谁变了你拦得住时间么 提交于 2019-11-26 12:50:49
问题 I\'ve looked in different questions for a solution and I\'ve tried what was suggested but I have not found a solution to make it work. Everytime I want to run this code it always says: Error in plot.new() : figure margins too large and I don\'t know how to fix it. Here is my code: par(mfcol=c(5,3)) hist(RtBio, main=\"Histograma de Bio Pappel\") boxplot(RtBio, main=\"Diagrama de Caja de Bio Pappel\") stem(RtBio) plot(RtBio, main=\"Gráfica de Dispersión\") hist(RtAlsea, main=\"Histograma de

How to plot a circle in Matlab?

不问归期 提交于 2019-11-26 11:34:24
问题 I would like to know how can I graph circles in matlab knowing the center and radius? I have tried circles() which does not seem to work because my matlab version does not have it. I know I can use the Rectangle function to do so but it is a rather complex way of doing it as I would need to work out the leftmost point everytime. Isnt there a more simple way for me to draw a circle JUST knowing center and radius? many thanks 回答1: Don't laugh, but the easiest would be to use the rectangle

Matplotlib (pyplot) savefig outputs blank image

ε祈祈猫儿з 提交于 2019-11-26 10:21:43
I am trying to save plots I make using matplotlib; however, the images are saving blank. Here is my code: plt.subplot(121) plt.imshow(dataStack, cmap=mpl.cm.bone) plt.subplot(122) y = copy.deepcopy(tumorStack) y = np.ma.masked_where(y == 0, y) plt.imshow(dataStack, cmap=mpl.cm.bone) plt.imshow(y, cmap=mpl.cm.jet_r, interpolation='nearest') if T0 is not None: plt.subplot(123) plt.imshow(T0, cmap=mpl.cm.bone) #plt.subplot(124) #Autozoom #else: #plt.subplot(124) #Autozoom plt.show() plt.draw() plt.savefig('tessstttyyy.png', dpi=100) And tessstttyyy.png is blank (also tried with .jpg) First, what