Code Monkey home page Code Monkey logo

Comments (4)

maartenbreddels avatar maartenbreddels commented on May 22, 2024 1

In the first example, replace size by 10. Initially, size (or s argument) was a fraction of the box size, but since humans aren't that good with numbers between 0 and 1, I switched to percentages, so 100 is the size of the box/volume, 10 is 10% of it. It will be in the changelog for the next release, sorry for this, that's the fate of early adopters I'm afraid ;). For the 2nd example it's the same, try removing the /10. Also, i'm not adopting matplotlib's short argument names (s versus size), since we have tab-completion in the notebook, and that leads to more readable code.

I'm working on examples, stay tuned for the next release.
I agree with you on the colormap.
What is planned for color is these options:

  • shape is 0 dim, and it's a string, interpret as color
  • shape is 1 dim, items are strings, seperate color for each item
  • shape is 2 dim, items are strings, sequence of the above
  • no color scale / colormap is set
  • shape is 1 dim, items are floats, it should be of length 3 -> rgb values (possibly later 4 for opacity)
  • shape is 2 dim, items are float, it should be of shape (len(x), 3) -> rgb values
  • shape is 3 dim, items are float, it should be (sequence_length, len(x), 3) -> rgb values
  • color scale / colormap is set
    • shape is 0 dim, item if float, use the colorscale to map to color
    • shape is 1 dim, it's a seperate color for each item
    • shape is 2 dim, again a sequence

without having a default colormap/colorscale, it will try to interpret it as rgb values, when a colorscale is set, it will use that. For now you have to use matplotlib's colormaps directly (opacity is ignored):

import ipyvolume
import matplotlib.cm
x = np.array([1,2,3,4,5])
y = np.array([2,4,3,2,1])
z = np.array([9,8,3,4,1])
c = matplotlib.cm.afmhot(np.linspace(0, 1, len(x)))
ipyvolume.quickscatter(x, y, z, color=c, size=10, marker="sphere")

I'd like to delay colormap/colorscale in ipyvolume until jupyter-widgets/ipywidgets#1153 takes more shape.

Let me know if this answer your questions.

from ipyvolume.

jeammimi avatar jeammimi commented on May 22, 2024

I think both cases were fixed in the last commit
Also try setting the size to 1, because apparently 0.1 is quite small.

from ipyvolume.

slinnarsson avatar slinnarsson commented on May 22, 2024

Thanks - it works!

from ipyvolume.

maartenbreddels avatar maartenbreddels commented on May 22, 2024

👍 for letting me know

from ipyvolume.

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.