Exemple #1
0
def plot_bleb_evolution(ts, prop_to_plots, title):
    """Plot evolution of a given bleb property over time"""
    title = title.replace("\u00B5", "u")
    plt = Plot((title + " against time"), "Time", title)
    plt.add("line", ts, prop_to_plots)
    plt.show()
    plot_data = [(t, d) for t, d in zip(ts, prop_to_plots)]
    return plt.getImagePlus(), plot_data
def plotRotation(roi_number, result_path, t, x, y, rotation_speed):
    # plot t-x, t-y, x-y, t-rotation_speed and save plot+roi_number.bmp
    txplot = Plot('x-t plot','time (s)', 'x (pixel)', t, x)
    typlot = Plot('y-t plot','time (s)', 'y (pixel)', t, y)
    xyplot = Plot('x-y plot', 'x (pixel)', 'y (pixel)', x, y)
    tspeedplot = Plot('Rotation speed-t plot','time (s)', 'Rotaion Speed (Hz)', t, rotation_speed)

    graphW = 1000
    graphH = 500
    txplot.setFrameSize(graphW, graphH)
    typlot.setFrameSize(graphW, graphH)
    xyplot.setFrameSize(graphW, graphH)
    tspeedplot.setFrameSize(graphW, graphH)

    #make plots as stack image
    tximp = txplot.getImagePlus()
    xyimp = xyplot.getImagePlus()
    tyimp = typlot.getImagePlus()
    tsimp = tspeedplot.getImagePlus()

    pstack = ImageStack(tximp.width,tximp.height)
    pstack.addSlice(tximp.getProcessor())
    pstack.addSlice(tyimp.getProcessor())
    pstack.addSlice(xyimp.getProcessor())
    pstack.addSlice(tsimp.getProcessor())
    pstackimp = ImagePlus('plots', pstack)

    pstackM = MontageMaker().makeMontage2(pstackimp, 2, 2, 2, 1, 4, 1, 0, False)
    #pstackM.show()
    IJ.saveAs(pstackM, 'BMP', os.path.join(result_path,'Plot' + str(roi_number) + '.bmp'))

    tximp.close()
    xyimp.close()
    tyimp.close()
    tsimp.close()
    pstackM.close()
Exemple #3
0
			row=[ str(p[i]) for p in profiles ]
			row=",".join(row)
			f.write(row+"\n")

# Generate a plot
if doPlot:
	from ij.gui import Plot
	from java.awt import Color
	p = Plot('Profiles','Channel #','Intensity')
	p.setSize(640,480)
	maxP = len(profiles)
	maxV = 0
	for iprofile,profile in enumerate(profiles):
		h = 0.66-(float(iprofile)/maxP)
		if h<0:
			h=h+1
		p.setColor(Color.getHSBColor( h,.8,1))
		p.addPoints(range(len(profile)),profile,p.LINE)
	
		maxV_=max(profile)
		if maxV < maxV_:
			maxV = maxV_
	p.setLimits(0,len(profile)-1,0,maxV*1.2)
	p.setLegend("\n".join(names),p.TOP_LEFT|p.LEGEND_TRANSPARENT)
	p.show()
	
	# Save the plot as PNG
	if doSavePlot:
		imp = p.getImagePlus()
		IJ.saveAs(imp,'PNG',file.absolutePath + "_compensationPlot.png")
Exemple #4
0
plt = cf.getPlot()
plt.draw()

left = 0
right = 5
bottom = 0
top = 5
nPoints = 4
rng = right - left

# Create filled plot
plt = Plot("Line plot", "X", "Y")
plt.setLimits(left, right, bottom, top)
plt.setFrameSize(600, 300)
plt.setColor("blue", "#ccccff")
# the circles are small. Can't figure out how to make
# them larger... These 2 calls are equivalent...
# plt.addPoints(jxa,jya, Plot.CIRCLE)
plt.add("circles", jxa, jya)
# this is even harder to see...
# plt.addPoints(jxa,jya, Plot.CROSS)
plt.setColor(Color.RED)
plt.setLineWidth(1)
plt.drawLine(0.0, 2.5, 4.0, 4.5)
plt.setXYLabels("X", "Y")
plt.show()

plt_imp = plt.getImagePlus()
IJ.saveAs(plt_imp, "PNG", plt_path)