Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 21 15:18
    tshead2 commented #199
  • Apr 21 04:08
    gavinhodge commented #199
  • Apr 21 04:08
    gavinhodge opened #199
  • Feb 03 16:51
    tshead2 commented #52
  • Feb 02 16:38
    janxkoci commented #52
  • Jun 01 2020 07:56
    kmatt closed #75
  • May 25 2020 22:22
    tshead commented #198
  • May 25 2020 12:42
    pulkin opened #198
  • May 18 2020 21:42

    tshead2 on master

    Create a notebook with some exa… (compare)

  • May 01 2020 19:04

    tshead2 on master

    More work on the !@$! mp4 and p… (compare)

  • May 01 2020 18:52

    tshead2 on master

    Add missing copyright notice, a… (compare)

  • May 01 2020 18:21

    tshead2 on master

    Regenerate conf.py from scratch… (compare)

  • Apr 28 2020 15:41

    tshead2 on master

    Remove obsolete, unused code. (compare)

  • Apr 28 2020 05:21

    tshead2 on master

    Rename sandbox to notebooks, fo… Add a violin plot case study. (compare)

  • Apr 28 2020 04:13

    tshead2 on master

    Another attempt to tweak code h… (compare)

  • Apr 28 2020 03:59

    tshead2 on master

    Tweaking language highlighting. (compare)

  • Apr 28 2020 03:42

    tshead2 on master

    Switch to nbsphinx to integrate… (compare)

  • Apr 22 2020 18:35
    tshead2 closed #197
  • Apr 22 2020 18:35
    tshead2 commented #197
  • Apr 22 2020 18:32

    tshead2 on master

    Bump version number after relea… (compare)

matrixbot
@matrixbot
hannes i have unique x and y axes for each series
Timothy M. Shead
@tshead

@matrixbot : There is an implicit assumption with scatterplot() that your series are all the same length. When that isn’t the case, just make multiple calls to scatterplot() and you’ll get what you’re expecting.

Cheers,
Tim

egayer
@egayer
Hi all, new with toyplot and trying to figure out how I could use it with Spyder. Which render should I use ? thanks
matrixbot
@matrixbot
hannes it depends (tm)
hannes just use the default until it does not do what you need
egayer
@egayer
@matrixbot well, objects are created but nothing is displayed when using python inline backend or Qt5 backend.
Timothy M. Shead
@tshead
I’m unfamiliar with Spyder, but it looks like it has support for Jupyter notebooks. Try familiarizing yourself with Toyplot in a notebook.
matrixbot
@matrixbot
hannes egayer (Gitter): you can get a plot if you make the ipython console return your canvas object
hannes posted an image: Untitled.png
hannes hm, when using matplotlib, one can get an image in there from a script itself by calling plt.show()
hannes i guess that is a super magic command
egayer
@egayer
(@matrixbot sorry can't see the image)
hannes sad how bad the state of relaying between messaging services still is :(
egayer
@egayer
@matrixbot alright... my bad! that was simple ! I will try to see how it can be displayed on a Qt5 external window, if it can...
egayer
@egayer
btw last stupid question: is there the equivalent of the matplotlibrc file ? here I understand it would be a CSS file, but can't find the "default" style sheet. I would like to use it to learn how to create new CSS files (with specific axis color, grid dash lines for example) and call it for theming toyplot plots the way we can call matplotlib style sheets. thanks again
egayer
@egayer
just got half of an answer using canvas.style.items()
Timothy M. Shead
@tshead
@egayer - you can display a canvas in a Jupyter Qt console directly. I’ve expanded the documention on rendering at https://toyplot.readthedocs.io/en/latest/rendering.html to cover this more explicitly.
There is no default style sheet for Toyplot, you have to make those changes in your code when you create figures.
egayer
@egayer
@tshead thank you Timothy and thank you @matrixbot it is clear and works perfectly !
jemmasters
@jemmasters
is it possible to embed toyplot to tkiner, wxPython, Qt or kivy GUI frameworks?
matrixbot
@matrixbot
hannes i see no reason why not
Eaton Lab
@eaton-lab
Hi @tshead , I noticed that ._children lists no longer exist for canvas and axes objects. What is the recommended alternative for accessing child objects in v.0.19?
Timothy M. Shead
@tshead2

Hey @eaton-lab ! The replacement for _children is the _scenegraph, which is maintained by the canvas and provides a more flexible, open-ended way to keep track of relationships between objects. I created a notebook to demonstrate:

https://github.com/sandialabs/toyplot/blob/master/notebooks/scene-graph-usage.ipynb

You will see that there's more than one type of relationship, but "render" is equivalent to the old parent-child relationship. Note that you can access _scenegraph from the canvas or the axes, but it's all the same object. I'd be interested to hear how you're using it?

Cheers,
Tim

Eaton Lab
@eaton-lab
hi @tshead2 , I've been wondering whether you have plans for development of a 'radial' axes class? I envision this would be very useful for chord diagrams and various other circular plotting tools. And creating an axes class to automatically project marks into radial units would make it easier to create arc as lines or rectangles mapped into radial coordinates rather than creating a separate marker for arc-type elements.
Anyway, I bring this up after spending a ton of time writing support to project trees into radial positions on cartesian axes in toytree, which was painful but doable. As usual, getting the extents of text elements to work right was the hardest part.
Timothy M. Shead
@tshead
Hey, @eaton-lab! I’ve never needed radial axes in my work, but I had them in mind when I was developing the marks/coordinates idea Toyplot. The intent would be that bar marks would map to either wedges or arcs using polar coordinates, instead of boxes in cartesian coordinates. Got any screenshots? I’m curious whether polar coordinates are all that is needed, or whether you’re doing anything more sophisticated?
Eaton Lab
@eaton-lab
Screenshot from 2020-10-15 19-57-00.png
Screenshot from 2020-10-15 19-55-31.png
The first screencap above shows four three drawings. The first two are normal cartesian coordinates, the second two project polar coordinates into cartesian space. The last one uses curved edges, which wasn't yet supported in toyplot but I sort of kludged it together.
The SVG example below that is showing an example of a path element as an arc around a circle. This is something I want to support so I can add an arc around a circular tree to label parts of it.
But instead of kludging it together, I thought perhaps a more toyplot-like way to do this might be:
Eaton Lab
@eaton-lab
# in theory radial would plot x to angle or radians and y to radius
axes = toyplot.Radial()
axes.plot([0, 25], [50, 25], color='blue')
but from looking at svg elements, its not clear to me how to create a filled rectangle element like a wedge using rect or polygon.
Eaton Lab
@eaton-lab
More generally, this type of radial figure is becoming quite popular, but is not easily implemented in common Python plotting tools. For example, to implement a chord plot in Python I've only found a few examples such as this one which requires holoviews and is overly complex IMO: https://holoviews.org/reference/elements/bokeh/Chord.html
Timothy M. Shead
@tshead
Drawing a radial wedge in SVG is no problem, it’s just a filled path that contains alternating lines and arcs. Alternatively, you might be able to get away with just an arc, with a really wide stroke width. Mainly, I’m thinking through whether polar coordinates are sufficient for your use case. Refresh my memory: toytree is building a toyplot graph under the hood, is that right? And the toyplot graph contains more nodes and edges than the tree, in order to explicitly capture the layout? Assuming that’s correct, is toyplot doing all of the rendering once it’s a graph, or are you overriding that too?
Eaton Lab
@eaton-lab
I used to use a graph object, but since v2 I have written a custom ToyTreeMark object that is rendered with the toyplot dispatch _render call.
I see, makes sense about combining lines and arcs.
Here's the current custom Mark and render code for toytree: https://github.com/eaton-lab/toytree/blob/master/toytree/Render.py
Timothy M. Shead
@tshead
Hah, I’m pretty jazzed to see a custom mark! I guess the real question is whether changing the projection is sufficient. I’m of a mind to stub-out a simple set of radial coordinates, and then let you provide feedback on whether it works or not.
Timothy M. Shead
@tshead
As an aside, I’m of a mind to bump the version to 1.0 in the near future, and then revisit the design for version 2. I use Toyplot nearly every day, and there are things with which I’m very satisfied (explicit, predictable layout, consistent appearance whether in a notebook or a PDF), and things that are disappointing (web interaction never got very far, too slow for animation, Python still doesn’t have a decent, portable, vector drawing library).
Eaton Lab
@eaton-lab
Yes, writing the custom Mark was fun, and definitely helped me to better understand how toyplot works under-the-hood.
Eaton Lab
@eaton-lab
Congrats on the upcoming 1.0 milestone. I agree toyplot seems quite stable. I definitely promote it to a lot of people. I'd be happy to try out a new radial axes class and give feedback if you add a stub to v2 dev.
Eaton Lab
@eaton-lab
Hi @tshead , is there a simple way to modify the z-order of marks after a plot has been generated? Maybe by accessing the scenegraph?
Eaton Lab
@eaton-lab
Screenshot from 2020-11-08 15-09-35.png
for me the idea is to allow annotating a tree figure after the fact like the example here:
Eaton Lab
@eaton-lab
On a related note, it would be really cool to be able to support a linear gradient colormap to rectangle objects like in your documentation using toyplot.color.LinearMap. I would have a bunch of uses for this type of function if it were easier to use...
Timothy M. Shead
@tshead
@eaton-lab - if by scenegraph you mean the XML tree, then yes - that would be the only practical way to do it. The only guarantees Toyplot provides WRT z-order is that the order in which marks are created affects their z-order in the obvious "painters’ algorithm" way.
I’m not following the confusion / issue with colormaps - are you wanting to draw a gradient, or having trouble mapping colors to rectangles? If it’s the latter, I could use an example.