Giter Club home page Giter Club logo

Comments (6)

anntzer avatar anntzer commented on June 14, 2024

What's mplcairo.__version__? (That'll give me the commit the nightly is from.)

from mplcairo.

anntzer avatar anntzer commented on June 14, 2024

I see where the exception is coming from. Do you, by any chance, have the path.simplify_threshold set to a nonzero value? Does setting it to zero fix the issue?

If it does, what's happening is the following:
In order to improve the performance of drawing scatterplots with various sizes and colors, whenever it is asked to draw a PathCollection (the class behind scatterplots), mplcairo keeps a cache of the scatter elements drawn at various sizes (lazily populated on-demand), so that rasterization is performed only once and later uses can just "stamp" the image from the buffer.
Unfortunately, fill_between is also implemented using PathCollection, so mplcairo tries to do the same here... and ends up trying to draw the fill_between polygon at an enourmous magnification (at that point it doesn't realize yet that the thing will be cropped).

I plan to fix that by following the same strategy as for draw_markers, which is to fall back on "naive" drawing when the polygon is bigger than the canvas size (for example).

I cannot reproduce the backend changing issue (I get module://mplcairo.qt all the time). What's your version of ipython, do you have anything of interest in your ipython_config.py, do you use e.g. %matplotlib auto, do you use MPLBACKEND, etc.?

from mplcairo.

afvincent avatar afvincent commented on June 14, 2024

FWIW (I still have to read #4).

The mplcairo version that I am using:

In [1]: mplcairo.__version__
Out[1]: '0.1a1.post15+g322e722'

Excerpt from my matplotlibrc file:

### SAVING FIGURES
#path.simplify : True   # When True, simplify paths by removing "invisible"
                        # points to reduce file size and increase rendering
                        # speed
#path.simplify_threshold : 0.1  # The threshold of similarity below which
                                # vertices will be removed in the simplification
                                # process
#path.snap : True # When True, rectilinear axis-aligned paths will be snapped to
                  # the nearest pixel when certain criteria are met.  When False,
                  # paths will never be snapped.
#path.sketch : None # May be none, or a 3-tuple of the form (scale, length,
                    # randomness).
                    # *scale* is the amplitude of the wiggle
                    # perpendicular to the line (in pixels).  *length*
                    # is the length of the wiggle along the line (in
                    # pixels).  *randomness* is the factor by which
                    # the length is randomly scaled.

Excerpt from my .bashrc file:

export MPLBACKEND="module://mplcairo.qt"

I am using IPython 6.2.1 (from conda). AFAICT, I am not using a peculiar ipython_config.py file (there is no such file in $HOME/.ipython/), but indeed it looks like an IPython issue:

python example_issue_mplcairo.py 
#0 module://mplcairo.qt
#1 module://mplcairo.qt
#2 module://mplcairo.qt
#3 module://mplcairo.qt

from mplcairo.

anntzer avatar anntzer commented on June 14, 2024

OK, I can reproduce it now. What's your ~/.config/matplotlib/matplotlibrc?

from mplcairo.

afvincent avatar afvincent commented on June 14, 2024

As it is several hundreds of line long, see the gist here. (I cannot remember if I modified it a lot or not compared to the default version.)

from mplcairo.

afvincent avatar afvincent commented on June 14, 2024

FWIW, (at least on my side) it looks like #5 fixes the second half of the issue ;).

from mplcairo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.