Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Changing polygon linestyle?

edited October 2013 in OpenSesame

Does anyone know if polygon line style can be changed? Possibly using Scipy, or Matplotlib? I need to change the line style of certain polygons from "-" to "--", but the function doesn't seem to be built into the polygon object...

Thanks!

Lee

Update: OS won't import Matplotlib, I'm getting an error similar to the one in this discussion.

Comments

  • edited 1:44PM

    Hi Lee,

    There doesn't appear to be a way to easily draw dotted or dashed lines using any of the common drawing toolkits. Matplotlib should be able to do it, and it should be importable in the WinPython OpenSesame package:

    The thing is, though, that matplotlib is really a library for plotting graphs (which is why it has line-style options, of course), and it will be a hassle to use it for drawing polygons in OpenSesame.

    Perhaps you can use a cheap workaround? For example, you could draw a set of vertical lines with the background color on top of your polygon. That way you will kind of get a dashed line.

    Cheers,
    Sebastiaan

  • edited October 2013

    Sebastiaan,

    Thanks for the thoughts - I had hoped that I could use matplotlib.lines and just use the 'set_linestyle' in a similar fashion to the 'set_penwidth' currently available in the canvas - after all, the canvas is surely just a big plotting area??

    However, I hadn't thought of the low-budget version, so much easier! I think I'll go with that then... I can't see any reason why it wouldn't work.

    Thanks,

    Lee

    P.S. would a linestyle option be a future development possibility?

  • edited 1:44PM

    Thanks for the thoughts - I had hoped that I could use matplotlib.lines and just use the 'set_linestyle' in a similar fashion to the 'set_penwidth' currently available in the canvas - after all, the canvas is surely just a big plotting area??

    In principle, yes. What makes it difficult is getting the matplotlib figure onto the OpenSesame canvas. You would probably have to first save it to a file and then have OpenSesame load the image from disk. So it's a hassle-but possible.

    P.S. would a linestyle option be a future development possibility?

    I'm afraid that's unlikely to happen anytime soon, because it would require that all of the libraries used by the various back-ends support this functionality, while none of them currently do.

  • edited 1:44PM

    Okay, that makes sense!

    Best,

    Lee

Sign In or Register to comment.