T O P I C R E V I E W |
cts18488 |
Posted - 03/05/2024 : 06:58:08 AM Hi,
Is Origin able to create quiver plots? If yes, can this be done using python as well?
Thank you, Tibi |
23 L A T E S T R E P L I E S (Newest First) |
YimingChen |
Posted - 05/21/2024 : 4:46:20 PM It is hard to tell. You may need to add pi to the angle values, since tan(theta) = tan(theta + pi) .
James |
cts18488 |
Posted - 05/21/2024 : 05:59:31 AM I have tried continuously to run the script. In some cases, it works nicely on some occasions (like in the replies above). However, there are some examples in which the graphs are not the same (I have attached the pictues). They are like mirror images. Do you know what might cause this behaviour? Thank you.
quote: Originally posted by YimingChen
You could add the lines below to the end:
gl = op.find_graph()[0]
# set x scale range
gl.set_xlim(0,15,5)
# add title
gl.set_int('title',1)
title = gl.label('_TITLE')
title.text = 'Quiver Plot'
# hide legend
lgnd = gl.label('Legend')
lgnd.show = 0
|
YimingChen |
Posted - 05/15/2024 : 11:12:54 AM You could add the lines below to the end:
gl = op.find_graph()[0]
# set x scale range
gl.set_xlim(0,15,5)
# add title
gl.set_int('title',1)
title = gl.label('_TITLE')
title.text = 'Quiver Plot'
# hide legend
lgnd = gl.label('Legend')
lgnd.show = 0
|
cts18488 |
Posted - 05/15/2024 : 10:55:43 AM Thank you. That is working brilliantly.
Since this is a bit different (in terms of plotting), can I control the axis range, add a title and remove the legend?quote: Originally posted by YimingChen
Please try the sample Python script on the project in the attachment.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiverTest.zip
James
|
YimingChen |
Posted - 05/10/2024 : 09:52:33 AM Please try the sample Python script on the project in the attachment.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiverTest.zip
James |
cts18488 |
Posted - 05/07/2024 : 08:13:44 AM Thank you.
Would you be kind please to send the code on how to do the plotting using a script, especially on how to do the calculations in the python?
quote: Originally posted by YimingChen
Please find the attached project file. You need to first understand how the vectors magnitude and angles are calculated in the Python script. Thanks.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiverPlot.opju
James
|
YimingChen |
Posted - 04/29/2024 : 2:40:50 PM Please find the attached project file. You need to first understand how the vectors magnitude and angles are calculated in the Python script. Thanks.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiverPlot.opju
James |
cts18488 |
Posted - 04/29/2024 : 05:43:57 AM Hi, sure. Please find attached it as a zip file.
In the zip file there is a test.xlsx file attached as well. If you want to run the script, you would be asked to choose a file (please choose the test file attached); at choose an option, type aLD (mdeg), for subsample factor type 2 and for scale 50000.
Please let me know if something is unclear. Thanks.quote: Originally posted by cts18488
Hi,
Is Origin able to create quiver plots? If yes, can this be done using python as well?
Thank you, Tibi
https://my.originlab.com/ftp/forum_and_kbase/Images/Quiver_plot_script.zip |
YimingChen |
Posted - 04/26/2024 : 5:04:16 PM Could you provide the Python code to make the graph?
quote: Originally posted by cts18488
Hi James,
Thank you for your help.
Unfortunately this is not I want. I want to obtain the same graph in Origin as I get using matplotlib. I have already attached what I have obtained in matplotlib in a previous reply. In theory I should get the same graph either using Origin or matplotlib using the same data, but this is not the case. If it helps, I can attach the python script and a sample file.
Thank you again.
quote: Originally posted by YimingChen
Please check find the attached project file. I assume X2_coord and Y2_coord are the vector magnitudes along x and y direction. and I transform them to angular and vector magnitude values. See if it works.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiver_plot_Origin_YM.opju
James
|
cts18488 |
Posted - 04/26/2024 : 3:05:54 PM Hi James,
Thank you for your help.
Unfortunately this is not I want. I want to obtain the same graph in Origin as I get using matplotlib. I have already attached what I have obtained in matplotlib in a previous reply. In theory I should get the same graph either using Origin or matplotlib using the same data, but this is not the case. If it helps, I can attach the python script and a sample file.
Thank you again.
quote: Originally posted by YimingChen
Please check find the attached project file. I assume X2_coord and Y2_coord are the vector magnitudes along x and y direction. and I transform them to angular and vector magnitude values. See if it works.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiver_plot_Origin_YM.opju
James
|
YimingChen |
Posted - 04/26/2024 : 08:58:40 AM Please check find the attached project file. I assume X2_coord and Y2_coord are the vector magnitudes along x and y direction. and I transform them to angular and vector magnitude values. See if it works.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiver_plot_Origin_YM.opju
James |
cts18488 |
Posted - 04/26/2024 : 05:56:32 AM Hi,
I have noticed that it is possible to upload files here as well. Please find them attached.
quote: Originally posted by minimax
Hi Tibi,
You can click the "Send File to Tech support" link on the top right corner on this page to send the file.
It is appreciated to include this post link in your email.
https://my.originlab.com/ftp/forum_and_kbase/Images/quiver_plot_Origin.opjuhttps://my.originlab.com/ftp/forum_and_kbase/Images/quiver_plot_XY_swapped_Origin.opju |
minimax |
Posted - 04/26/2024 : 02:46:38 AM Hi Tibi,
You can click the "Send File to Tech support" link on the top right corner on this page to send the file.
It is appreciated to include this post link in your email. |
cts18488 |
Posted - 04/25/2024 : 09:11:17 AM Yes, sure. If you can give me an email address I can send you the Origin file.quote: Originally posted by YimingChen
could you share your data here for us to test?
|
YimingChen |
Posted - 04/25/2024 : 08:25:54 AM could you share your data here for us to test? |
cts18488 |
Posted - 04/25/2024 : 04:18:36 AM The angular unit was set to Radians which is ok. However I have tried the other 2 options but with no effect.quote: Originally posted by cts18488
Hi,
Is Origin able to create quiver plots? If yes, can this be done using python as well?
Thank you, Tibi
|
YimingChen |
Posted - 04/24/2024 : 2:05:34 PM One thing you can check is the unit of the angle. Please go to menu Preferences->Options..., Under Numeric Format tab, please set proper angular unit.
|
cts18488 |
Posted - 04/24/2024 : 11:59:36 AM This is working nicely. Thank you!
However, now I have another issue. I have plotted the data (same values) with matplotlib and Origin and the graphs are not similar (see picture attached). In the matplotlib plot there is clearly a trend whereas, in the Origin plot, the arrows all over the place. Can this be fixed? What might be the issue?
Thanks again!
quote: Originally posted by YimingChen
If you create the quiver plot with XYAM type of data, in the Plot Details dialog, you can set the Multiplier of the magnitude. Try the code below to create XYAM vector plot.
import os
import originpro as op
import numpy as np
scale = 10
r = 2
a = -np.pi/6
wks = op.new_sheet()
x1 = np.linspace(1,10,10)
wks.from_list(0,x1)
y1 = np.linspace(1,10,10)
wks.from_list(1,y1)
a = [a]*10
r = [r*scale]*10
wks.from_list(2,a)
wks.from_list(3,r)
wks.lt_exec('worksheet -s 1 1 4 -1;')
wks.lt_exec('worksheet -p 208;')
|
YimingChen |
Posted - 04/19/2024 : 12:41:21 PM If you create the quiver plot with XYAM type of data, in the Plot Details dialog, you can set the Multiplier of the magnitude. Try the code below to create XYAM vector plot.
import os
import originpro as op
import numpy as np
scale = 10
r = 2
a = -np.pi/6
wks = op.new_sheet()
x1 = np.linspace(1,10,10)
wks.from_list(0,x1)
y1 = np.linspace(1,10,10)
wks.from_list(1,y1)
a = [a]*10
r = [r*scale]*10
wks.from_list(2,a)
wks.from_list(3,r)
wks.lt_exec('worksheet -s 1 1 4 -1;')
wks.lt_exec('worksheet -p 208;')
|
cts18488 |
Posted - 04/19/2024 : 10:32:07 AM I was asking as matplotlib has this option: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.quiver.html (see "scale") and I was wondering if Origin has this option as well. That would be a very nice feature.
quote: Originally posted by YimingChen
The length of the arrow is defined by the data. In the XYXY vector plot, the first set of XY represents the start coordinate of the arrow and the second set of XY represents the end coordinate of the arrow.
|
YimingChen |
Posted - 04/15/2024 : 4:20:17 PM The length of the arrow is defined by the data. In the XYXY vector plot, the first set of XY represents the start coordinate of the arrow and the second set of XY represents the end coordinate of the arrow. |
cts18488 |
Posted - 04/12/2024 : 10:28:00 AM Thanks. It is working.
Is it possible to control the length of the arrow to reasonable sizes as some of them are quite long? quote: Originally posted by YimingChen
Can you try the Python script below in Origin?
import os
import originpro as op
wks = op.new_sheet()
dc = op.Connector(wks, dctype='Origin', keep_DC=True)
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Tutorial Data.opju'),dctype='Origin', sel='[Book9E]2D Vector XYXY')
wks.cols_axis('XYXY')
# plot whole sheet as XYXY plot
wks.lt_exec('worksheet -s 1 1 4 -1;')
wks.lt_exec('worksheet -p 218;')
James
|
YimingChen |
Posted - 03/05/2024 : 09:38:05 AM Can you try the Python script below in Origin?
import os
import originpro as op
wks = op.new_sheet()
dc = op.Connector(wks, dctype='Origin', keep_DC=True)
wks.from_file(os.path.join(op.path('e'), 'Samples', 'Tutorial Data.opju'),dctype='Origin', sel='[Book9E]2D Vector XYXY')
wks.cols_axis('XYXY')
# plot whole sheet as XYXY plot
wks.lt_exec('worksheet -s 1 1 4 -1;')
wks.lt_exec('worksheet -p 218;')
James |