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
 Plotting 2D Contour plot via python
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

OriginUser_FS

Germany
3 Posts

Posted - 01/31/2023 :  07:59:35 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2022
Operating System: Windows 10

Hello everyone,

i have a question to the use of python outside of origin to plot 2D contour plots. I saw in this entry (https://www.originlab.com/doc/python/Examples/Graphing) that it is possible to plot a contour plot using xyz coordinates. Is it also possible to plot it via a virtual matrix like it is in the origin application itself? (so via the plotvm)
I am having a lower number of x coordinates, than i am having of y and z, which would make the use of the virtual matrix very practical.


Thanks in advance and best regards
FS

YimingChen

1616 Posts

Posted - 01/31/2023 :  3:28:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
plotvm is actually an X-function so the add_plot method in Python won't work. You can call X-function from Python though. Please activate the worksheet of your data, and run the Python script below:
op.lt_exec("plotvm rowpos:=none colpos:=none ogl:=<new template:=contour>;")


James
Go to Top of Page

OriginUser_FS

Germany
3 Posts

Posted - 02/01/2023 :  04:45:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, helped me a lot.

I didnt find any argument to set the ranges of the x, y or z values displayed. There is sth called rowrng however this selects, as i got it, only the x/y row if we did not specify it in rowpos. Is there anything i overlooked, or is there maybe another function to do that?

BR
FS

Go to Top of Page

YimingChen

1616 Posts

Posted - 02/01/2023 :  09:01:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Please check the Python reference page below:
https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1GLayer.html#ade5e9d47cf32ffa00ac59728605ea04e

https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1Plot.html#a7545ca68323d5cf9ce8de84edfcb478f

James
Go to Top of Page

OriginUser_FS

Germany
3 Posts

Posted - 02/02/2023 :  04:42:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
sorry for the odd question, but i am not so familiar with labtalk, but how do i access the graph object i created with the labtalk command? To then execute the methods, to manipulate the graph, you also referred to.

The only thing it is returning is a bool, and i couldnt find another labtalk command to assign it to a variable.

Furthermore i tried to export a worksheet as a csv file with
op.lt_exec("expASC path:="c:\signal.csv";") and i am getting an Syntax error for "C:" at this stage. Im not quite sure why this happens, because i just took the command line as it was written here: https://www.originlab.com/doc/en/X-Function/ref/expASC

BR
FS

Edited by - OriginUser_FS on 02/02/2023 07:54:01 AM
Go to Top of Page

YimingChen

1616 Posts

Posted - 02/02/2023 :  09:47:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What object did you create with LT? Do you mean the window object like layer, axis, etc? Or do you mean graph object? Please check the two pages below:
https://www.originlab.com/doc/LabTalk/ref/Visual-objs-Created-by-Origin-obj
https://www.originlab.com/doc/LabTalk/ref/Graphic-objs

Regarding the script to export worksheet to csv, can you try below?
op.lt_exec(r'expASC path:="c:\signal.csv";')


James
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