Skip to content

Plotting with BigFloats #176

Open
Open

Description

@yakir12

So this is understandable, and most def not your doing, but currently despite the fact that we can do all of this with BigFloats for crazy accuracy, we can not plot the results. So either mention this in the docs, show a workaround, include a method that fixes this, or change the plotting to something that does (I doubt this exists, but maybe Makie?).


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

  1. Datseris commented on Nov 5, 2018

    @Datseris
    Member

    It is always helpful to post the code that lead to this issue, and maybe even the error message :)

  2. Datseris commented on Nov 5, 2018

    @Datseris
    Member

    plot(big.(rand(10))) works in PyPlot, so I don't see a reason that plotting shouldn't work. I'll look at this more once you've pasted the code that lead to the issue.

  3. yakir12 commented on Nov 6, 2018

    @yakir12
    Author

    Oh, sorry, I assumed this was a known problem. Here is the code:

    julia> using DynamicalBilliards
    
    julia> using PyPlot
    WARNING: using PyPlot.axes in module Main conflicts with an existing identifier.
    
    julia> bd = billiard_rectangle(BigFloat(2),BigFloat(2))
    Billiard{BigFloat} with 4 obstacles:
      Bottom wall
      Right wall
      Top wall
      Left wall
    
    julia> plot(bd)
    ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
    TypeError("ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''",)
      File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 1605, in xlim
        ret = ax.set_xlim(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2904, in set_xlim
        left, right = mtransforms.nonsingular(left, right, increasing=False)
      File "/usr/lib/python3/dist-packages/matplotlib/transforms.py", line 2773, in nonsingular
        if (not np.isfinite(vmin)) or (not np.isfinite(vmax)):
    
    Stacktrace:
     [1] pyerr_check at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:60 [inlined]
     [2] pyerr_check at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:64 [inlined]
     [3] macro expansion at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:84 [inlined]
     [4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44
     [5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{BigFloat,BigFloat}, ::Int64, ::Ptr{Nothing}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:22
     [6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{BigFloat,BigFloat}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:11
     [7] #pycall#88(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:86
     [8] pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:86
     [9] #xlim#137(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:179                                                                                
     [10] xlim at /home/yakir/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:176 [inlined]
     [11] #plot#85(::PyCall.PyObject, ::Function, ::Billiard{BigFloat,4,NTuple{4,InfiniteWall{BigFloat}},Nothing}) at /home/yakir/.julia/packages/DynamicalBilliards/pQCBP/src/plotting/billiards.jl:46
     [12] plot(::Billiard{BigFloat,4,NTuple{4,InfiniteWall{BigFloat}},Nothing}) at /home/yakir/.julia/packages/DynamicalBilliards/pQCBP/src/plotting/billiards.jl:39
     [13] top-level scope at none:0
  4. Datseris commented on Nov 8, 2018

    @Datseris
    Member

    So since we will be almost certainly porting plotting of this package to Makie I won't be spending time solving this. But I'll keep it open for reference, to be sure that this is tested when we go to makie!

  5. asinghvi17 commented on Aug 2, 2019

    @asinghvi17
    Member

    Makie converts internally to Float32, so BigFloats won't be as useful there. Still, it is possible.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions