Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with set_axis #5

Closed
14NGiestas opened this issue Sep 3, 2020 · 6 comments
Closed

Issues with set_axis #5

14NGiestas opened this issue Sep 3, 2020 · 6 comments

Comments

@14NGiestas
Copy link
Contributor

First of all, good job.
I noticed some issues with the function set_axis:

  1. There is a problem with small numbers and the descriptor F0.0 you are using there.
    I passed this vector to the function:
[-2.0943951023931956E-002,  0.13463968515384828 ,      -5.0000000000000000,        200.00000000000000]

And this is the output:

set xrange [-0.:0.]
set yrange [-5., 200.]

which gives me a error

"ogpf_temp_script.gp" line 6953: Can't plot with an empty x range!
  1. The interface don't allow to set one specific range like yrange or zrange without having to set the xrange
    I suggest using optional arguments to set each individual argument or maybe writing 3 new methods to each one
subroutine set_axis(this, xrange, yrange, zrange)
       class(gpf):: this
       real(wp), optional, intent(in) :: xrange(2)
       real(wp), optional, intent(in) :: yrange(2)
       real(wp), optioanl, intent(in) :: zrange(2)
       if (present(xrange)) then
               this%hasxrange=.true.
               this%xrange=xrange
       end if
       if (present(yrange)) then
               this%hasyrange=.true.
               this%yrange=yrange
       end if
       if (present(zrange)) then
               this%haszrange=.true.
               this%zrange=zrange
       end if
end subroutine
@kookma
Copy link
Owner

kookma commented Sep 4, 2020

@14NGiestas

I do not understand your first question: set xrange [-0.:0.] means plot on empty range and it returns by gnuplot NOT ogpf library.

For the second question: The method is a clone of axis in Matlab, but what you proposed is more flexible in comparison to the current procedure. I will apply this in the next release!

By the way: Feel free to modify the code, test and see if it works! Then you can inform me to update the code! If you know how to submit a PR do it please.

@14NGiestas
Copy link
Contributor Author

14NGiestas commented Sep 4, 2020

I mean when I set the axis using your function set_axis the output file generated by the library is wrong (the actual output is made by ogpf despite the error being thrown by gnuplot). In the subroutine processcmd there is a descriptor Fw.d to write the range stuff, however the decimal places "d" is set to zero rounding small numbers to zero at the output.
I fixed the issue by setting a non-zero decimal place, for eg.: replacing "F0.0" with "F0.3". But I'm sure this is not the best descriptor either, maybe a scientific notation or the G descriptor would be better:
intel reference to G descriptor
stack overflow mention to G0 descriptor

@14NGiestas
Copy link
Contributor Author

PR done #6

@14NGiestas
Copy link
Contributor Author

14NGiestas commented Sep 8, 2020

Closing the issue since the related PR was merged. I'm going to open another specific one related to the interface.

@kookma
Copy link
Owner

kookma commented Sep 8, 2020

@14NGiestas Thank you!

Please consider backward compatibility! The headers almost very similar to Octave and Matlab!

@14NGiestas
Copy link
Contributor Author

@14NGiestas Thank you!

Please consider backward compatibility! The headers almost very similar to Octave and Matlab!

Sure! I've introduced some samples to discuss in the issue #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants