The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 How to plot an " Image Plot" from a matrix
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cts18488

United Kingdom
83 Posts

Posted - 12/10/2024 :  5:12:53 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2024b and Service Release (Select Help-->About Origin):
Operating System: Windows11

Hi,

Can you please tell me what is the code to plot an "Image Plot" from a matrix? Can you please add the code how to change the colour pallete and how to set the levels for the colour scale. Thank you!

ChaoC

USA
180 Posts

Posted - 12/10/2024 :  8:03:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

1. You can activate your matrix and run: op.lt_exec('run.section(Plot3D.ogs,ImagePlot)')

2. Documentation for setting colormap:
https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1Plot.html#a5d33966d43e1be87689f6488d418a542

3. You can use lt_exec with these LabTalk options:
https://www.originlab.com/doc/LabTalk/ref/Layer-CMap-obj

E.g op.lt_exec('layer.cmap.nummajorLevels=8')
op.lt_exec('layer.cmap.setLevels(1)')

Best,
Chao
Go to Top of Page

minimax

351 Posts

Posted - 12/11/2024 :  09:35:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi cts18488,

Besides the lt_exec() method ChaoC mentioned, you may also try following

import originpro as op
ms=op.find_sheet('m', '[MBook1]')
gl = op.new_graph(template='image')[0]
gl.add_mplot(ms, z=0, type=220) #220 is image plot type id
#https://www.originlab.com/doc/zh/LabTalk/ref/Plot-Type-IDs
gl.rescale()

pl = gl.plot_list()[0]
zl = pl.zlevels
zl['minors'] = 4
zl['levels'] = [0, 8, 16, 24, 32]
pl.zlevels = zl
pl.colormap = 'Beach.pal'

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000