Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] Image Plot #68

Open
jakirkham opened this issue Nov 16, 2019 · 7 comments
Open

[FEA] Image Plot #68

jakirkham opened this issue Nov 16, 2019 · 7 comments
Assignees
Labels
0 - Backlog In queue waiting for assignment feature request New feature or request

Comments

@jakirkham
Copy link
Member

Is your feature request related to a problem? Please describe.

It would be nice to have a way to plot an image using an array of data (like a CuPy array). For example, here is Bokeh's image plot. Also here are some examples from Matplotlib.

Describe the solution you'd like

Basically something like image or imshow would capture my needs.

It's worth noting that people plotting images usually expect the origin to be in the upper left. For some interesting discussion in a case where a library deviated from this please see issue ( bokeh/bokeh#1666 ). Though it could make sense to have a user configurable origin to smooth over these differences.

Describe alternatives you've considered

Heatmap is close, but not quite what I'm looking for. It results in the image looking less smooth than one would like. That said, it could be a reasonable starting point if the implementations are close.

Additional context

This is mostly above, but would be happy to answer more questions. 🙂

@AjayThorve
Copy link
Member

AjayThorve commented Nov 18, 2019

okay, this is certainly possible. It is slightly different than generating a heatmap as it works only with a cudf dataframe with 2 columns as x,y-coordinates and another column as aggregate values.

My assumption is(from the examples you suggest), you would like to generate an image from a (n*n) cupy array by just providing a color palette.

Taking inspiration from the bokeh example, would something like this work for you? :

import cupy, cuxfilter
N = 500
x = cupy.linspace(0, 10, N)
y = cupy.linspace(0, 10, N)
xx, yy = cupy.meshgrid(x, y)
cupy_arr = cupy.sin(xx)*cupy.cos(yy)

cux_df = cuxfilter.DataFrame.from_cupy(cupy_arr)

chart1 = cuxfilter.image(color_palette='Spectral11', origin='bottom-left')
d = cux_df.dashboard([chart1])

chart1.view()

image

@AjayThorve AjayThorve self-assigned this Nov 18, 2019
@jakirkham
Copy link
Member Author

Thanks @AjayThorve! I think that would do nicely 😀

@jakirkham
Copy link
Member Author

So I ran this, but got the following error. Am just running from master.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-3a90a8595424> in <module>
----> 1 import cupy, cuxfilter
      2 N = 500
      3 x = cupy.linspace(0, 10, N)
      4 y = cupy.linspace(0, 10, N)
      5 xx, yy = cupy.meshgrid(x, y)

~/cuxfilter/python/cuxfilter/__init__.py in <module>
----> 1 from .dataframe import DataFrame
      2 
      3 from ._version import get_versions
      4 
      5 __version__ = get_versions()["version"]

~/cuxfilter/python/cuxfilter/dataframe.py in <module>
      4 from typing import Type
      5 
----> 6 from .dashboard import DashBoard
      7 from .layouts import single_feature
      8 from .themes import light

~/cuxfilter/python/cuxfilter/dashboard.py in <module>
      5 from panel.io.server import get_server
      6 
----> 7 from .charts.core.core_chart import BaseChart
      8 from .datatile import DataTile
      9 from .layouts import single_feature

~/cuxfilter/python/cuxfilter/charts/__init__.py in <module>
      6 
      7 from .bokeh import bokeh
----> 8 from .cudatashader import cudatashader
      9 from .altair import altair
     10 from .panel_widgets import panel_widgets

~/cuxfilter/python/cuxfilter/charts/cudatashader/__init__.py in <module>
----> 1 from .cudatashader import scatter_geo, scatter, line, heatmap, stacked_lines

~/cuxfilter/python/cuxfilter/charts/cudatashader/cudatashader.py in <module>
----> 1 from . import plots
      2 
      3 
      4 def scatter_geo(
      5     x,

~/cuxfilter/python/cuxfilter/charts/cudatashader/plots.py in <module>
      7 from .custom_extensions import InteractiveImage
      8 
----> 9 import cudatashader as cds
     10 from cudatashader import transfer_functions as tf
     11 from cudatashader.colors import Hot

ModuleNotFoundError: No module named 'cudatashader'

@AjayThorve
Copy link
Member

Oh, I am sorry for the misunderstanding, I was just confirming if the syntax was such, would you be fine with it. It's not implemented yet, hopefully soon.

@jakirkham
Copy link
Member Author

Ah ok, sorry, I got really excited to try. Apologies for misreading things. 😅

Yeah I think the syntax is reasonable. Thanks for giving that a go.

It's probably worth taking a look at imshow and matshow to get a better feeling on what the different origin locations are used for.

@github-actions
Copy link

This issue has been marked rotten due to no recent activity in the past 90d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@github-actions
Copy link

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

@exactlyallan exactlyallan added 0 - Backlog In queue waiting for assignment feature request New feature or request and removed inactive-30d inactive-90d labels Mar 4, 2021
@caryr35 caryr35 added this to cuxfilter Dec 5, 2022
@exactlyallan exactlyallan moved this to Done in cuxfilter Mar 9, 2023
@exactlyallan exactlyallan moved this from Done to Informational in cuxfilter May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - Backlog In queue waiting for assignment feature request New feature or request
Projects
Status: Informational
Development

No branches or pull requests

3 participants