cS = np.sqrt(Te0/mi) rhoS = cS/omCI # From normalization of parallel current equation factor = (omCI**2)*n0 # Obtain the suptitle suptitle = fig.texts[0].get_text() # Close the figure plt.close(fig) #}}} # Make new ax to plot to fig, (normalAx ,nnAx) = plt.subplots(ncols=2,\ figsize = SizeMaker.array(2,1, aSingle=0.5)) size = "large" #{{{Extract and plot nn # Find the min and the max maxmin = [] for line in oldNnAx.get_lines(): x, y = line.get_data() x *= rhoS y *= factor maxmin.append((np.max(y), np.min(y))) nnAx.plot(x,y, color=line.get_color()) # Set the texts maxInd = np.argmax(tuple(curVal[0] for curVal in maxmin)) minInd = np.argmin(tuple(curVal[1] for curVal in maxmin))
mi = 39.948 * cst.u e = cst.e omCI = e * B0 / mi cS = np.sqrt(Te0 / mi) rhoS = cS / omCI # From normalization of parallel current equation factor = omCI * n0 * e * cS # Obtain the suptitle suptitle = fig.texts[0].get_text() # Make new ax to plot to fig, newAx = plt.subplots(figsize=SizeMaker.standard(w=4, a=0.5)) maxmin = [] for line in oldAx.get_lines(): x, y = line.get_data() x *= rhoS y *= factor ny = len(x) maxmin.append((np.max(y), np.min(y))) newAx.plot(x, y, color=line.get_color()) # Set the texts maxInd = np.argmax(tuple(curVal[0] for curVal in maxmin)) minInd = np.argmin(tuple(curVal[1] for curVal in maxmin)) boltzmann = oldAx.get_lines()[minInd]
# Make segments # +3 as we would like some space between the bars lenKeys = len(keys) + 5 nBars = len(modes) * lenKeys xBarVals = tuple(range(nBars)) data["Arithmetics"]["x"] = xBarVals[0::lenKeys] data["Communication"]["x"] = xBarVals[1::lenKeys] data["Input/output"]["x"] = xBarVals[2::lenKeys] data["Laplace inversions"]["x"] = xBarVals[3::lenKeys] data["Time solver"]["x"] = xBarVals[4::lenKeys] tickVals = data["Input/output"]["x"] # Create the figure fig, ax = plt.subplots(figsize=SizeMaker.standard(a=0.5, s=0.5)) for key in keys: d = data[key] ax.bar(d["x"], d["mean"], yerr=d["std"], label=key) PlotHelper.makePlotPretty(ax) ax.xaxis.grid(False) ax.xaxis.set_ticks(tickVals) ax.xaxis.set_ticklabels( ("Initial\nphase", "Expand\nphase", "Linear\nphase", "Turbulent\nphase")) ax.set_ylabel("$\%$") # Move legend outside handles, labels = ax.get_legend_handles_labels()
ax = fig.get_axes()[0] # Get the legends, and make keys out of these handles, labels = ax.get_legend_handles_labels() # Obtain the lines for nr, label in enumerate(labels): sD[scan][label] = ax.get_lines()[nr].get_data()[1] xAxis = ax.get_lines()[0].get_data()[0] plt.close(fig) # Make a new figure fig, (sAx, kAx) = plt.subplots(nrows=2, figsize = SizeMaker.standard(w=3, a=1.5),\ sharex=True) for scan in scans: curScan = float(scan[4:]) for key in sD[scan].keys(): if "skew" in key.lower(): sAx.plot(xAxis, sD[scan][key],\ ls = sD[scan]["ls"],\ color = sD[scan]["color"],\ marker = sD[scan]["marker"],\ ms = 7,\ alpha = 0.7,\ label = "$B_0 = {} \mathrm{{T}}$".format(curScan)\ ) sAx.set_ylabel(key.replace("Skewness", r"Skewness \;"))