T O P I C R E V I E W |
cts18488 |
Posted - 06/28/2022 : 10:07:10 AM Origin Ver. 2021b and Service Release (Select Help-->About Origin): SR2 Operating System: Windows 10 Ent
Hi,
Is it possible to set the axis ticks at the middle of the squares in heatmaps? Instead of placing integer numbers, the ticks corresponding to the middle to the square to be displayedThis is the code I am using:
def origin_shutdown_exception_hook(exctype, value, traceback): '''Ensures Origin gets shut down if an uncaught exception''' op.exit() sys.__excepthook__(exctype, value, traceback) if op and op.oext: sys.excepthook = origin_shutdown_exception_hook
if op.oext: op.set_show(True)
wks = op.new_sheet(type='m', lname='CD-mode Heatmap Plot') # for matrices wks.name = 'CD' wks.from_np(CD_new) x1,x2,y1,y2 = minx, maxx, miny, maxy wks.xymap = x1,x2,y1,y2
gr = op.new_graph(template=('' + new_path_template + '\\Origin templates\\MMP_plot_heatmap3.otpu'))
gl_1 = gr[0] p1 = gl_1.add_mplot(wks, 0, type = 105) gl_1.set_ylim(min_y, max_y) gl_1.set_xlim(min_x, max_x) gl_1.axis('y').title = f'Y in mm ({distance_y} \u03BCm steps)' gl_1.axis('x').title = f'X in mm ({distance_x} \u03BCm steps)' gl_1.lt_exec("SPECTRUM1.title$=CD (mdeg);") gl_1.rescale() z = p1.zlevels z['minors'] = 6 z['levels'] = [min_value_CD, min_value_CD/2, 0, max_value_CD/2, max_value_CD] p1.zlevels = z
And the result is in the picture attached:
Thanks! |
3 L A T E S T R E P L I E S (Newest First) |
YimingChen |
Posted - 06/28/2022 : 4:51:58 PM gl_1.set_int('x.label.decPlaces', 2) |
cts18488 |
Posted - 06/28/2022 : 3:24:20 PM Thanks. It is working. Appreciate your help, also do you know how to set up the number of decimal places? For example to 2?
quote: Originally posted by YimingChen
You need to set the first tick position and the tick increment. Can you add the following lines at the end of your code?
gl_1.set_float('x.inc', (maxx - minx) / 4)
gl_1.set_float('x.firstTick', minx)
gl_1.set_float('y.inc', (maxy - miny) / 4)
gl_1.set_float('y.firstTick', miny)
James
|
YimingChen |
Posted - 06/28/2022 : 11:44:23 AM You need to set the first tick position and the tick increment. Can you add the following lines at the end of your code?
gl_1.set_float('x.inc', (maxx - minx) / 4)
gl_1.set_float('x.firstTick', minx)
gl_1.set_float('y.inc', (maxy - miny) / 4)
gl_1.set_float('y.firstTick', miny)
James |
|
|