 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 815 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Mon Aug 17, 2020 12:39 pm Post subject: Suggestion - native %pl |
|
|
In addition to the present options in the native %pl for link (i.e. none, lines, curves) a useful future addition would be �spectrum�.
This would treat the x,y data input to %pl as frequency and magnitude data, and for each data point i it would draw a single line between two points i.e. ( x(i), y(i) ) and ( x(i), 0 ), creating a spectrum type plot.
I know this can be achieved indirectly by using the %pl call back or by careful stacking of the input data into multiple graphs, but I suspect that a more direct method would be useful to �new� users trying to plot such frequency domain plots before they conclude that %pl cannot use used to display data in this format.
Ken |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Mon Aug 17, 2020 2:46 pm Post subject: |
|
|
Ken
Thanks for the suggestion. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Tue Aug 18, 2020 7:31 pm Post subject: |
|
|
Maybe two weeks say.
Would it only be vertical lines? If also horizontal lines (x(i),y(i)) to (0,y(i)), what would you call that? |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 815 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed Aug 19, 2020 1:36 pm Post subject: |
|
|
Paul,
I don�t see a need for horizontal lines, but I suppose somebody out there might have such a requirement. �Column� or �stem� instead of �spectrum� and �bars� and for the horizontal lines, or perhaps �y_spoke� and �h_spoke�, or �y_stem� and �h_stem� if you prefer a mechanical or botanical analogy?
For my applications, on occasion, both the x (frequency) and y (magnitude) data can become negative, so it�s not just the first quadrant I am thinking about.
Thanks
Ken |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Wed Aug 26, 2020 12:26 pm Post subject: |
|
|
The "link" option for %pl has been extended to provide [link=columns] and [link=bars]. The first gives columns from the x-axis to the data points. The second gives bars from the y-axis to the data points. The width of a column and the height of a bar is determined by the selected line width. |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 815 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed Aug 26, 2020 12:48 pm Post subject: |
|
|
Paul,
Thanks for this addition.
Ken |
|
Back to top |
|
 |
Kenneth_Smith
Joined: 18 May 2012 Posts: 815 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Thu Aug 27, 2020 3:39 pm Post subject: |
|
|
John,
Here is the code for a simple test I've just run. You must explicitly specify a value for width.
Code: | !Spectrum test
use clrwin
implicit none
integer, parameter :: dp = kind(1.d0)
integer, parameter :: n = 10
real(kind=dp):: mag(1:n) = 0.d0, h(1:n)=0.d0
integer i, iw
do i = 1, n
mag(i) = 1.d0/i
h(i) = i
end do
iw = winio@('%mn[Exit]&','exit')
iw = winio@('%fn[Tahoma]%ts&',1.5d0)
call winop@('%pl[native,independent,x_array,gridlines,frame,link=columns,width=10,colour=blue]')
call winop@('%pl[Title="Harmonic content of a square wave"]')
call winop@('%pl[x_axis="Harmonic order",y_axis="Harmonic magnitude",dx=1,x_max=10.5,y_min=0,dy=0.25,y_max=1]')
iw = winio@('%pl&',600,400,n,h,mag)
iw = winio@(' ')
end |
Here is a link to the image:
https://www.dropbox.com/s/81txtrnjghfg7zy/spectrum.jpg?dl=0
PS I have just sent myself to the bottom of the class! There should be no even harmonics in a symmetrical waveform! |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Sat Oct 10, 2020 5:26 pm Post subject: |
|
|
I have looked at this and for this sample on my machine the position needs to be 1 or 2 pixels to the level. I opted for 1 pixel and ran my %pl test suite.
Everything was OK except for one similar (single digit) case where the position became off centre the other way.
I have retained the shift left by one pixel so this sample will look better but the change could have an adverse effect in some cases.
Please consider this matter as closed. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|