diff --git a/docs/.doctrees/environment.pickle b/docs/.doctrees/environment.pickle index 8b57732d..dc28055c 100644 Binary files a/docs/.doctrees/environment.pickle and b/docs/.doctrees/environment.pickle differ diff --git a/docs/.doctrees/main/cell_color.doctree b/docs/.doctrees/main/cell_color.doctree index 58836051..d456b1b1 100644 Binary files a/docs/.doctrees/main/cell_color.doctree and b/docs/.doctrees/main/cell_color.doctree differ diff --git a/docs/_sources/main/cell_color.rst.txt b/docs/_sources/main/cell_color.rst.txt index 3f4b1a21..a7b30eb5 100644 --- a/docs/_sources/main/cell_color.rst.txt +++ b/docs/_sources/main/cell_color.rst.txt @@ -10,18 +10,16 @@ must return a RGBA array (0-255) or a standard color name. # set a continuous colormap to the "sepal_length" column @table.foreground_colormap("sepal_length") - def f(v): - i = (v - 4) / 4 - return [255, 0, int(255 * i), 255] + def _(x: float): + red = np.array([255, 0, 0, 255], dtype=np.uint8) + blue = np.array([0, 0, 255, 255], dtype=np.uint8) + return (x - lmin) / lrange * blue + (lmax - x) / lrange * red .. code-block:: python # set a discrete colormap to the "sepal_width" column @table.background_colormap("sepal_width") - def f(v): - if v < 3.2: - return "green" - else: - return "purple" + def _(x: float): + return "green" if x < 3.2 else "violet" .. image:: ../fig/colormap.png diff --git a/docs/main/cell_color.html b/docs/main/cell_color.html index 23c539ac..983df39e 100644 --- a/docs/main/cell_color.html +++ b/docs/main/cell_color.html @@ -91,18 +91,16 @@

Set Cell Colors
# set a continuous colormap to the "sepal_length" column
 @table.foreground_colormap("sepal_length")
-def f(v):
-    i = (v - 4) / 4
-    return [255, 0, int(255 * i), 255]
+def _(x: float):
+    red = np.array([255, 0, 0, 255], dtype=np.uint8)
+    blue = np.array([0, 0, 255, 255], dtype=np.uint8)
+    return (x - lmin) / lrange * blue + (lmax - x) / lrange * red
 
# set a discrete colormap to the "sepal_width" column
 @table.background_colormap("sepal_width")
-def f(v):
-    if v < 3.2:
-        return "green"
-    else:
-        return "purple"
+def _(x: float):
+    return "green" if x < 3.2 else "violet"
 
../_images/colormap.png diff --git a/docs/searchindex.js b/docs/searchindex.js index 0de17543..e287548c 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["apidoc/modules", "apidoc/tabulous", "apidoc/tabulous.widgets", "index", "main/cell_color", "main/cheat_sheet", "main/dock_widget", "main/filter", "main/non_mainwindow", "main/quickstart", "main/selections", "main/table_advanced", "main/user_interface"], "filenames": ["apidoc\\modules.rst", "apidoc\\tabulous.rst", "apidoc\\tabulous.widgets.rst", "index.rst", "main\\cell_color.rst", "main\\cheat_sheet.rst", "main\\dock_widget.rst", "main\\filter.rst", "main\\non_mainwindow.rst", "main\\quickstart.rst", "main\\selections.rst", "main\\table_advanced.rst", "main\\user_interface.rst"], "titles": ["tabulous", "tabulous package", "tabulous.widgets package", "tabulous", "Set Cell Colors", "Cheat Sheet for Napari Users", "Custom Dock widget", "Filter Table Data", "Use Non-main Window Table Viewers", "Quickstart", "Table Selections", "Working with Tables", "User Interface"], "terms": {"packag": [0, 3, 8], "subpackag": 0, "widget": [0, 1, 7, 9], "submodul": 0, "filter": [0, 1, 3], "modul": [0, 3, 11], "mainwindow": [0, 1], "content": 0, "color": [0, 2, 3, 12], "core": 0, "except": [0, 10], "type": [0, 2, 3, 8, 9, 11, 12], "normalize_color": 1, "str": [1, 2, 6], "iter": 1, "int": [1, 2, 4], "tupl": [1, 2, 10], "sourc": [1, 2], "rgba_to_str": 1, "rgba": [1, 4], "current_view": 1, "tableviewerbas": [1, 2], "get": [1, 2, 9, 10, 12], "current": [1, 2, 9, 11], "tabl": [1, 2, 4, 5, 6], "viewer": [1, 2, 3, 6, 10, 11], "open_sampl": [1, 2, 10], "sample_nam": [1, 2], "plugin_nam": 1, "seaborn": [1, 2], "open": [1, 2, 7, 8, 10, 11], "sampl": [1, 2, 10], "data": [1, 2, 3, 6, 8, 9, 11, 12], "read_csv": [1, 9], "path": [1, 2, 8, 9], "arg": [1, 2], "kwarg": 1, "read": [1, 2, 9], "csv": [1, 9], "file": [1, 2, 8, 9], "add": [1, 2, 3, 9, 11], "read_excel": [1, 9], "excel": [1, 9], "all": [1, 8, 9], "sheet": [1, 3, 9], "set_current_view": 1, "set": [1, 2, 3, 7, 9, 11], "one": [1, 2, 6, 8, 11], "view_spreadsheet": 1, "name": [1, 2, 4, 5, 9, 11], "none": [1, 2, 6, 9, 10], "edit": [1, 2, 3, 7, 9, 11, 12], "bool": [1, 2], "true": [1, 2, 8, 9], "copi": [1, 2, 8, 9, 11], "view": [1, 2, 3, 8], "spreadsheet": [1, 2, 8, 11], "view_tabl": [1, 5], "fals": [1, 2], "class": [1, 2, 6, 8], "exceptionhandl": 1, "hook": 1, "callabl": [1, 2], "tracebacktyp": 1, "ani": [1, 2, 3, 12], "base": [1, 2, 3, 9], "object": [1, 2, 9, 10, 12], "handl": 1, "gui": [1, 9], "thread": 1, "selectionrangeerror": 1, "valueerror": 1, "rais": 1, "when": [1, 2, 9, 11], "i": [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12], "caus": 1, "wrong": [1, 9], "select": [1, 2, 3, 9], "rang": [1, 9, 10], "": [1, 11], "headerinfo": 1, "index": [1, 2, 3, 9, 11], "valu": [1, 2, 3, 4, 9, 10, 12], "old_valu": 1, "namedtupl": 1, "A": [1, 2, 4, 7, 8, 10, 11], "header": [1, 2, 11], "updat": [1, 2, 3, 9], "take": [1, 8, 9], "where": 1, "item": 1, "new": [1, 2, 6, 9, 11], "old": 1, "alia": [1, 6], "field": [1, 8], "number": [1, 2], "0": [1, 4, 5, 7, 9, 10, 11], "2": [1, 2, 4, 7, 9, 10, 11], "1": [1, 2, 7, 9, 10, 11], "iteminfo": 1, "row": [1, 2, 10], "slice": [1, 7, 9, 10], "column": [1, 2, 4, 9, 10, 11], "3": [1, 2, 4, 7, 9, 10, 11], "selectionrang": [1, 2, 10], "tablebas": [1, 2], "sequenc": [1, 2], "specif": [1, 2, 8, 11], "list": [1, 2, 6, 10, 11], "properti": [1, 2, 7, 8, 9, 10, 11], "selecteddata": 1, "tablecolumn": 1, "x": [1, 10, 11], "tabledata": [1, 6], "tabledatatupl": 1, "tableinfo": 1, "gener": 1, "describ": 1, "datafram": [1, 2, 6, 7, 9, 10], "its": [1, 9, 12], "y": [1, 11], "equival": [1, 2, 7, 11], "pd": [1, 2, 6, 9], "addit": 1, "inform": [1, 6, 11], "magicgui": [1, 3, 11], "construct": [1, 2], "magictableview": [1, 8], "tab_posit": [1, 2], "tabposit": [1, 2], "top": [1, 2], "label": [1, 2, 7, 12], "tooltip": [1, 12], "visibl": [1, 2, 8, 9], "enabl": [1, 11], "tableviewerwidget": [1, 2, 8], "thi": [1, 2, 3, 4, 7, 8, 9, 11], "subclass": [1, 8], "so": [1, 8, 11], "can": [1, 2, 4, 6, 7, 8, 9, 10, 11, 12], "us": [1, 2, 3, 9, 10, 12], "compat": [1, 2, 8], "wai": [1, 9, 11], "napari": [1, 3, 6], "paramet": [1, 2], "like": [1, 2, 7, 9, 10], "metadata": [1, 2], "dict": [1, 2], "_dataframetablelay": [1, 2], "implement": [1, 2, 3, 11], "check": [1, 2, 9, 11, 12], "option": [1, 2, 9], "default": [1, 2, 9, 11], "whether": [1, 2], "via": [1, 2, 9], "ui": [1, 2, 8], "tableview": [1, 2, 3, 5, 9], "show": [1, 2, 8, 9, 11], "The": [1, 2, 4, 7, 8, 9, 10, 11, 12], "main": [1, 2, 3, 9], "add_dock_widget": [1, 2, 5, 6], "qwidget": [1, 2, 6, 8], "area": [1, 2, 3], "right": [1, 2, 7], "allowed_area": [1, 2], "event": [1, 2, 3, 10], "tableviewersign": [1, 2], "remove_dock_widget": [1, 2], "name_or_widget": [1, 2], "reset_choic": [1, 2], "_": [1, 2], "statu": [1, 2, 6], "return": [1, 2, 4, 6, 8, 11], "statup": [1, 2], "tip": [1, 2, 6], "non": [1, 2, 3], "add_widget": [1, 2], "columnfilt": 2, "func": [2, 11], "seri": 2, "repr": 2, "classmethod": 2, "from_oper": 2, "operator_nam": 2, "kei": [2, 7, 11, 12], "other": [2, 8, 9, 11], "an": [2, 6], "instanc": [2, 7, 8, 9, 10, 11], "from": [2, 6, 7, 8, 9, 11], "oper": [2, 11], "__eq__": 2, "target": 2, "argument": 2, "initi": 2, "given": 2, "filterindex": 2, "current_filt": 2, "_void": 2, "chain": 2, "filterproxi": 2, "proxi": 2, "make": [2, 9], "easier": 2, "For": [2, 7, 8, 10, 11], "you": [2, 4, 6, 7, 8, 9, 10, 11, 12], "do": [2, 4, 9], "5": [2, 9, 10, 11], "which": 2, "lambda": [2, 7], "df": [2, 5, 7, 9, 10], "arrai": [2, 4, 6, 7], "filtertyp": 2, "function": [2, 4, 7, 8, 9, 10, 11, 12], "connect": [2, 8, 10], "consol": [2, 8, 9], "parent": [2, 6], "t": [2, 9], "_noref": 2, "_compon": 2, "compon": 2, "qtconsol": 2, "buffer": 2, "text": [2, 4], "execut": 2, "toolbar": [2, 3, 7, 9, 11], "tabletyp": 2, "enum": 2, "enumer": 2, "add_groupbi": 2, "groupbi": 2, "dataframegroupbi": 2, "add_lay": 2, "input": [2, 9], "add_load": 2, "loader": 2, "_tablelik": 2, "tabledisplai": 2, "frame": 2, "continu": [2, 4], "displai": 2, "add_spreadsheet": [2, 9], "ad": [2, 6, 9, 11], "add_tabl": [2, 5, 9, 11], "befor": [2, 11], "avoid": [2, 8], "overwrit": [2, 9], "origin": [2, 11], "If": [2, 7, 8, 9, 11, 12], "same": [2, 6, 11], "exist": [2, 9, 11], "copy_data": 2, "selectiontyp": 2, "_singleselect": 2, "cell": [2, 3, 9, 10], "clipboard": 2, "current_index": [2, 9], "current_t": [2, 9], "keymap": [2, 9], "qtkeymap": 2, "nativ": [2, 8], "_qtmainwidgetbas": 2, "pathlik": 2, "plugin": 2, "paste_data": 2, "past": [2, 8], "save": 2, "union": 2, "byte": 2, "screenshot": 2, "np": [2, 6], "ndarrai": [2, 6], "run": 2, "tablelist": 2, "signalgroup": [2, 10], "signal": 2, "group": 2, "declar": 2, "emitt": 2, "descriptor": 2, "protocol": 2, "http": 2, "doc": 2, "python": [2, 3, 9], "org": 2, "howto": 2, "html": 2, "descriptorhowto": 2, "design": [2, 3, 8], "attribut": [2, 10, 11], "support": [2, 7, 9], "signatur": 2, "provid": [2, 4], "contructor": 2, "psygnal": [2, 10], "import": [2, 6, 8, 9, 11], "myemitt": 2, "chang": [2, 3, 8, 12], "def": [2, 4, 6, 8, 9, 10, 11], "receiv": 2, "print": [2, 9, 10, 11], "emit": 2, "note": 2, "exampl": [2, 8], "abov": [2, 8], "signalinst": 2, "see": [2, 7, 8, 9, 11], "document": 2, "detail": [2, 7, 8], "how": [2, 8], "ha": [2, 8, 9, 11], "individu": 2, "singl": 2, "inspect": [2, 11], "descript": 2, "intern": [2, 7], "specifi": [2, 7], "bound": 2, "check_nargs_on_connect": 2, "posit": [2, 9], "against": 2, "callback": [2, 10], "also": [2, 8, 9, 11, 12], "time": 2, "check_narg": 2, "By": 2, "check_types_on_connect": 2, "check_typ": 2, "history_manag": 2, "o": 2, "histori": [2, 7], "manag": 2, "register_act": 2, "f": [2, 4, 6], "current_group": 2, "id": 2, "behav": [2, 9], "abc": 2, "layer": [2, 6], "add_side_widget": [2, 11], "wdt": 2, "qtw": [2, 8], "side": [2, 3], "background_colormap": [2, 4], "column_nam": [2, 11], "hashabl": 2, "colormap": [2, 4], "background": [2, 4], "rule": 2, "must": [2, 4], "interfac": [2, 3, 9], "wa": 2, "manual": [2, 9], "data_shown": 2, "shown": [2, 9, 11], "consid": 2, "foreground_colormap": [2, 4], "foreground": [2, 4], "move_iloc": 2, "move": [2, 9], "locat": 2, "indic": 2, "4": [2, 4, 7, 9, 10, 11], "move_loc": 2, "axi": 2, "mutabl": 2, "qbaset": 2, "backend": [2, 8], "plt": [2, 11], "plot": [2, 3], "precis": 2, "digit": 2, "refresh": 2, "table_shap": 2, "shape": [2, 9], "undo_manag": 2, "undomanag": 2, "undo": [2, 8], "view_mod": [2, 11], "mode": [2, 3], "zoom": [2, 11, 12], "float": 2, "factor": 2, "hotli": 2, "reload": 2, "interv": 2, "qt": [3, 11], "strongli": 3, "inspir": 3, "accordingli": [3, 9], "custom": [3, 9], "creation": 3, "easili": [3, 8, 9], "achiev": 3, "beginn": 3, "more": [3, 8, 10], "train": 3, "user": 3, "interact": [3, 12], "editor": [3, 12], "highli": 3, "customiz": 3, "extens": [3, 8], "catch": 3, "quickstart": 3, "cheat": 3, "canva": 3, "appli": [3, 6, 11], "programmat": [3, 8, 9, 11], "queri": 3, "style": 3, "work": [3, 8, 9, 12], "dock": [3, 11], "window": [3, 5, 9, 11], "your": [3, 12], "search": 3, "page": 3, "each": [4, 10, 11], "have": [4, 7, 8, 9], "map": [4, 7, 9], "255": 4, "standard": 4, "sepal_length": [4, 10], "v": [4, 11], "discret": 4, "sepal_width": 4, "green": 4, "els": 4, "purpl": 4, "tabul": [5, 8, 9], "view_imag": 5, "imag": [5, 6], "add_imag": 5, "qtpy": [6, 8], "qtwidget": [6, 8], "mywidget": [6, 8], "__init__": [6, 8], "self": [6, 8], "super": [6, 8], "setobjectnam": 6, "In": [6, 7, 8, 11], "imagedata": 6, "while": [6, 11], "want": [6, 8, 11, 12], "store": [6, 9], "should": 6, "strategi": 6, "recov": 6, "send": 6, "mean": [6, 11], "std": 6, "without": 7, "convert": [7, 9], "onli": 7, "d": 7, "boolean": 7, "follow": [7, 8, 9, 10, 12], "code": 7, "essenti": 7, "b": [7, 9, 11], "6": [7, 9, 10], "look": 7, "after": 7, "overlai": 7, "dialog": 7, "button": [7, 9, 12], "push": [7, 12], "combo": [7, 11, 12], "alt": [7, 9, 12], "click": [7, 9, 11, 12], "tab": [7, 9, 11], "express": 7, "api": [7, 11], "refer": 7, "panda": [7, 9], "eval": 7, "line": [7, 12], "auto": 7, "complet": 7, "brows": 7, "aim": 8, "better": [8, 11], "allow": 8, "mani": [8, 9, 12], "differ": [8, 11], "integr": 8, "extern": 8, "plan": 8, "child": 8, "anoth": 8, "version": 8, "myqwidget": 8, "qmainwindow": 8, "setcentralwidget": 8, "benefit": 8, "usual": 8, "too": [8, 9], "much": 8, "space": 8, "problem": 8, "solv": 8, "popup": 8, "To": [8, 11], "conflict": 8, "some": [8, 9], "restrict": 8, "embed": [8, 9, 12], "doe": [8, 11], "shortcut": [8, 9, 11], "ctrl": [8, 9, 11, 12], "shift": [8, 9, 12], "c": [8, 9, 11], "simpl": [8, 9], "load": 8, "contain": [8, 12], "fileedit": 8, "file_edit": 8, "append": 8, "magic": 8, "similar": [8, 11, 12], "thing": 8, "pathlib": 8, "magicclass": 8, "table_view": 8, "load_data": 8, "qvboxlayout": 8, "setlayout": 8, "layout": 8, "addwidget": 8, "redo": [8, 11], "ar": [8, 9, 11, 12], "avail": [8, 9, 11], "creat": 9, "tbl": 9, "just": 9, "xlsx": 9, "virtual": 9, "environ": 9, "conda": 9, "command": 9, "launch": 9, "It": 9, "sever": [9, 11], "conosol": 9, "activ": 9, "keyboard": [9, 12], "tool": 9, "analysi": [9, 11], "basic": [9, 11], "method": [9, 10, 11], "most": [9, 12], "fix": 9, "unless": 9, "fulli": 9, "new_data": 9, "reject": 9, "newli": 9, "structur": [9, 11], "th": 9, "renam": 9, "pass": 9, "directli": [9, 10, 11], "df2": 9, "sinc": [9, 11], "multi": 9, "slicabl": 9, "sel": [9, 10], "iloc": [9, 10, 11], "10": 9, "20": 9, "googl": 9, "string": 9, "unlimit": 9, "far": 9, "larg": [9, 11], "infer": 9, "obtain": 9, "u": 9, "ll": [9, 10], "dtype": 9, "int64": 9, "reason": [9, 11], "empti": 9, "extend": 9, "del": 9, "delet": 9, "acit": 9, "includ": 9, "global": 9, "press": [9, 11], "k": [9, 11], "registri": 9, "bind_kei": 9, "regist": [9, 10, 11], "bind": [9, 10], "p": [9, 11], "someth": 9, "q": 9, "iri": 10, "correspond": 10, "100": 10, "being": 10, "immut": 10, "thu": 10, "them": 10, "simpli": 10, "9": 10, "7": 10, "95": 10, "96": 10, "97": 10, "98": 10, "99": 10, "call": [10, 11], "everi": [10, 11], "_on_chang": 10, "split": 11, "two": 11, "part": 11, "scroll": [11, 12], "independ": 11, "horizont": 11, "vertic": 11, "reset": 11, "normal": 11, "turn": 11, "h": 11, "n": 11, "appear": 11, "insid": 11, "focu": [11, 12], "veri": 11, "small": 11, "affect": 11, "thei": 11, "still": 11, "bar": 11, "next": 11, "well": 11, "defin": 11, "let": 11, "sai": 11, "re": 11, "state": 11, "therefor": 11, "give": 11, "common": 11, "case": 11, "canvas": 11, "matplotlib": [11, 12], "pyplot": 11, "hist": 11, "scatter": 11, "loc": 11, "safe": 11, "immedi": 11, "index_nam": 11, "arrow": 12, "mac": 12, "modifi": 12, "expect": 12, "addition": 12, "mous": 12, "wheel": 12, "out": 12, "desir": 12, "direct": 12, "help": 12, "analyz": 12, "find": 12, "appropri": 12, "microsoft": 12, "offic": 12, "doubl": 12, "width": 12, "etc": 12, "wip": 12, "now": 12}, "objects": {"": [[1, 0, 0, "-", "tabulous"]], "tabulous": [[1, 1, 1, "", "MagicTableViewer"], [1, 1, 1, "", "Table"], [1, 1, 1, "", "TableViewer"], [1, 1, 1, "", "TableViewerWidget"], [1, 0, 0, "-", "color"], [1, 0, 0, "-", "core"], [1, 5, 1, "", "current_viewer"], [1, 0, 0, "-", "exceptions"], [1, 5, 1, "", "open_sample"], [1, 5, 1, "", "read_csv"], [1, 5, 1, "", "read_excel"], [1, 0, 0, "-", "types"], [1, 5, 1, "", "view_spreadsheet"], [1, 5, 1, "", "view_table"], [2, 0, 0, "-", "widgets"]], "tabulous.TableViewer": [[1, 2, 1, "", "add_dock_widget"], [1, 3, 1, "", "events"], [1, 2, 1, "", "remove_dock_widget"], [1, 2, 1, "", "reset_choices"], [1, 4, 1, "", "status"]], "tabulous.TableViewerWidget": [[1, 2, 1, "", "add_widget"], [1, 3, 1, "", "events"]], "tabulous.color": [[1, 5, 1, "", "normalize_color"], [1, 5, 1, "", "rgba_to_str"]], "tabulous.core": [[1, 5, 1, "", "current_viewer"], [1, 5, 1, "", "open_sample"], [1, 5, 1, "", "read_csv"], [1, 5, 1, "", "read_excel"], [1, 5, 1, "", "set_current_viewer"], [1, 5, 1, "", "view_spreadsheet"], [1, 5, 1, "", "view_table"]], "tabulous.exceptions": [[1, 1, 1, "", "ExceptionHandler"], [1, 6, 1, "", "SelectionRangeError"]], "tabulous.types": [[1, 1, 1, "", "HeaderInfo"], [1, 1, 1, "", "ItemInfo"], [1, 1, 1, "", "SelectionRanges"], [1, 5, 1, "", "TableColumn"], [1, 5, 1, "", "TableData"], [1, 5, 1, "", "TableDataTuple"], [1, 1, 1, "", "TableInfo"]], "tabulous.types.HeaderInfo": [[1, 3, 1, "", "index"], [1, 3, 1, "", "old_value"], [1, 3, 1, "", "value"]], "tabulous.types.ItemInfo": [[1, 3, 1, "", "column"], [1, 3, 1, "", "old_value"], [1, 3, 1, "", "row"], [1, 3, 1, "", "value"]], "tabulous.types.SelectionRanges": [[1, 4, 1, "", "values"]], "tabulous.widgets": [[2, 1, 1, "", "GroupBy"], [2, 1, 1, "", "SpreadSheet"], [2, 1, 1, "", "Table"], [2, 1, 1, "", "TableBase"], [2, 1, 1, "", "TableDisplay"], [2, 1, 1, "", "TableViewer"], [2, 1, 1, "", "TableViewerWidget"], [2, 0, 0, "-", "filtering"], [2, 0, 0, "-", "mainwindow"]], "tabulous.widgets.GroupBy": [[2, 4, 1, "", "current_group"]], "tabulous.widgets.TableBase": [[2, 2, 1, "", "add_side_widget"], [2, 2, 1, "", "background_colormap"], [2, 3, 1, "", "cell"], [2, 3, 1, "", "columns"], [2, 4, 1, "", "data"], [2, 4, 1, "", "data_shown"], [2, 4, 1, "", "editable"], [2, 3, 1, "", "filter"], [2, 2, 1, "", "foreground_colormap"], [2, 3, 1, "", "index"], [2, 4, 1, "", "keymap"], [2, 4, 1, "", "metadata"], [2, 2, 1, "", "move_iloc"], [2, 2, 1, "", "move_loc"], [2, 4, 1, "", "mutable"], [2, 4, 1, "", "name"], [2, 4, 1, "", "native"], [2, 3, 1, "", "plt"], [2, 4, 1, "", "precision"], [2, 2, 1, "", "refresh"], [2, 4, 1, "", "selections"], [2, 4, 1, "", "table_shape"], [2, 4, 1, "", "undo_manager"], [2, 4, 1, "", "view_mode"], [2, 4, 1, "", "zoom"]], "tabulous.widgets.TableDisplay": [[2, 4, 1, "", "interval"], [2, 4, 1, "", "loader"]], "tabulous.widgets.TableViewer": [[2, 2, 1, "", "add_dock_widget"], [2, 3, 1, "", "events"], [2, 2, 1, "", "remove_dock_widget"], [2, 2, 1, "", "reset_choices"], [2, 4, 1, "", "status"]], "tabulous.widgets.TableViewerWidget": [[2, 2, 1, "", "add_widget"], [2, 3, 1, "", "events"]], "tabulous.widgets.filtering": [[2, 1, 1, "", "ColumnFilter"], [2, 1, 1, "", "FilterIndexer"], [2, 1, 1, "", "FilterProxy"]], "tabulous.widgets.filtering.ColumnFilter": [[2, 2, 1, "", "from_operator"]], "tabulous.widgets.filtering.FilterIndexer": [[2, 2, 1, "", "chain"], [2, 2, 1, "", "filter"]], "tabulous.widgets.filtering.FilterProxy": [[2, 2, 1, "", "array"], [2, 4, 1, "", "func"], [2, 4, 1, "", "table"]], "tabulous.widgets.mainwindow": [[2, 1, 1, "", "Console"], [2, 1, 1, "", "TableType"], [2, 1, 1, "", "TableViewer"], [2, 1, 1, "", "TableViewerBase"], [2, 1, 1, "", "TableViewerSignal"], [2, 1, 1, "", "TableViewerWidget"], [2, 1, 1, "", "Toolbar"]], "tabulous.widgets.mainwindow.Console": [[2, 4, 1, "", "buffer"], [2, 2, 1, "", "execute"], [2, 4, 1, "", "visible"]], "tabulous.widgets.mainwindow.TableType": [[2, 3, 1, "", "spreadsheet"], [2, 3, 1, "", "table"]], "tabulous.widgets.mainwindow.TableViewer": [[2, 2, 1, "", "add_dock_widget"], [2, 3, 1, "", "events"], [2, 2, 1, "", "remove_dock_widget"], [2, 2, 1, "", "reset_choices"], [2, 4, 1, "", "status"]], "tabulous.widgets.mainwindow.TableViewerBase": [[2, 2, 1, "", "add_groupby"], [2, 2, 1, "", "add_layer"], [2, 2, 1, "", "add_loader"], [2, 2, 1, "", "add_spreadsheet"], [2, 2, 1, "", "add_table"], [2, 3, 1, "", "console"], [2, 2, 1, "", "copy_data"], [2, 4, 1, "", "current_index"], [2, 4, 1, "", "current_table"], [2, 3, 1, "", "events"], [2, 4, 1, "", "keymap"], [2, 4, 1, "", "native"], [2, 2, 1, "", "open"], [2, 2, 1, "", "open_sample"], [2, 2, 1, "", "paste_data"], [2, 2, 1, "", "reset_choices"], [2, 2, 1, "", "save"], [2, 2, 1, "", "screenshot"], [2, 2, 1, "", "show"], [2, 4, 1, "", "tables"], [2, 3, 1, "", "toolbar"]], "tabulous.widgets.mainwindow.TableViewerSignal": [[2, 3, 1, "", "current_index"]], "tabulous.widgets.mainwindow.TableViewerWidget": [[2, 2, 1, "", "add_widget"], [2, 3, 1, "", "events"]], "tabulous.widgets.mainwindow.Toolbar": [[2, 4, 1, "", "history_manager"], [2, 2, 1, "", "register_action"], [2, 4, 1, "", "visible"]]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:attribute", "4": "py:property", "5": "py:function", "6": "py:exception"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "property", "Python property"], "5": ["py", "function", "Python function"], "6": ["py", "exception", "Python exception"]}, "titleterms": {"tabul": [0, 1, 2, 3, 6], "packag": [1, 2], "subpackag": 1, "submodul": [1, 2], "color": [1, 4], "modul": [1, 2], "core": 1, "except": 1, "type": [1, 6, 10], "content": [1, 2, 5, 6, 7, 8, 9, 10, 11], "widget": [2, 3, 5, 6, 8, 11], "filter": [2, 7], "mainwindow": 2, "highlight": 3, "basic": [3, 6], "cooper": 3, "other": 3, "api": 3, "refer": 3, "indic": 3, "tabl": [3, 7, 8, 9, 10, 11, 12], "set": [4, 5], "cell": [4, 11], "cheat": 5, "sheet": 5, "napari": 5, "user": [5, 12], "open": [5, 9], "viewer": [5, 8, 9], "just": 5, "read": 5, "data": [5, 7, 10], "layer": 5, "list": [5, 9], "add": [5, 6], "get": 5, "dock": [5, 6], "custom": [6, 11], "us": [6, 7, 8, 11], "magicgui": [6, 8], "appli": 7, "programmat": 7, "queri": 7, "style": 7, "non": 8, "main": 8, "window": 8, "tableview": 8, "your": 8, "qt": 8, "quickstart": 9, "A": 9, "an": 9, "interpret": 9, "handl": 9, "spreadsheet": 9, "For": 9, "more": 9, "detail": 9, "kei": 9, "combo": 9, "select": 10, "catch": 10, "chang": 10, "work": 11, "view": 11, "mode": 11, "dual": 11, "popup": 11, "tile": 11, "how": 11, "until": 11, "side": 11, "area": 11, "exampl": 11, "plot": [11, 12], "canva": [11, 12], "undo": 11, "stack": 11, "updat": 11, "valu": 11, "interfac": 12, "toolbar": 12}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1, "sphinx": 56}}) +Search.setIndex({"docnames": ["index", "main/cell_color", "main/user_interface"], "filenames": ["index.rst", "main\\cell_color.rst", "main\\user_interface.rst"], "titles": ["tabulous", "Set Cell Colors", "User Interface"], "terms": {"i": [0, 2], "qt": 0, "base": 0, "data": [0, 2], "viewer": 0, "python": 0, "thi": [0, 1], "packag": 0, "strongli": 0, "inspir": 0, "napari": 0, "design": 0, "accordingli": 0, "custom": 0, "creation": 0, "easili": 0, "achiev": 0, "beginn": 0, "us": [0, 2], "magicgui": 0, "ani": [0, 2], "more": 0, "train": 0, "user": 0, "implement": 0, "interact": [0, 2], "editor": [0, 2], "highli": 0, "customiz": 0, "extens": 0, "catch": 0, "select": 0, "edit": [0, 2], "event": 0, "quickstart": 0, "cheat": 0, "sheet": 0, "interfac": 0, "toolbar": 0, "plot": 0, "canva": 0, "type": [0, 2], "chang": [0, 2], "filter": 0, "appli": 0, "programmat": 0, "queri": 0, "style": 0, "set": 0, "cell": 0, "color": [0, 2], "work": [0, 2], "view": 0, "mode": 0, "side": 0, "area": 0, "updat": 0, "valu": [0, 1, 2], "dock": 0, "add": 0, "non": 0, "main": 0, "window": 0, "tableview": 0, "your": [0, 2], "index": 0, "modul": 0, "search": 0, "page": 0, "The": [1, 2], "foreground": 1, "text": 1, "background": 1, "can": [1, 2], "each": 1, "column": 1, "you": [1, 2], "have": 1, "provid": 1, "colormap": 1, "function": [1, 2], "map": 1, "do": 1, "A": 1, "must": 1, "return": 1, "rgba": 1, "arrai": 1, "0": 1, "255": 1, "standard": 1, "name": 1, "continu": 1, "sepal_length": 1, "tabl": 1, "foreground_colormap": 1, "def": 1, "_": 1, "x": 1, "float": 1, "red": 1, "np": 1, "dtype": 1, "uint8": 1, "blue": 1, "lmin": 1, "lrang": 1, "lmax": 1, "discret": 1, "sepal_width": 1, "background_colormap": 1, "green": 1, "3": 1, "2": 1, "els": 1, "violet": 1, "arrow": 2, "kei": 2, "ctrl": 2, "mac": 2, "shift": 2, "modifi": 2, "expect": 2, "most": 2, "addition": 2, "mous": 2, "wheel": 2, "zoom": 2, "out": 2, "alt": 2, "scroll": 2, "desir": 2, "direct": 2, "If": 2, "keyboard": 2, "ar": 2, "check": 2, "contain": 2, "mani": 2, "help": 2, "analyz": 2, "click": 2, "button": 2, "push": 2, "focu": 2, "follow": 2, "tooltip": 2, "label": 2, "find": 2, "appropri": 2, "combo": 2, "get": 2, "want": 2, "similar": 2, "microsoft": 2, "offic": 2, "embed": 2, "also": 2, "doubl": 2, "object": 2, "its": 2, "line": 2, "width": 2, "etc": 2, "matplotlib": 2, "wip": 2, "now": 2}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"tabul": 0, "highlight": 0, "basic": 0, "cooper": 0, "other": 0, "widget": 0, "api": 0, "refer": 0, "indic": 0, "tabl": [0, 2], "set": 1, "cell": 1, "color": 1, "user": 2, "interfac": 2, "toolbar": 2, "plot": 2, "canva": 2}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.viewcode": 1, "sphinx": 56}}) diff --git a/rst/main/cell_color.rst b/rst/main/cell_color.rst index 3f4b1a21..a7b30eb5 100644 --- a/rst/main/cell_color.rst +++ b/rst/main/cell_color.rst @@ -10,18 +10,16 @@ must return a RGBA array (0-255) or a standard color name. # set a continuous colormap to the "sepal_length" column @table.foreground_colormap("sepal_length") - def f(v): - i = (v - 4) / 4 - return [255, 0, int(255 * i), 255] + def _(x: float): + red = np.array([255, 0, 0, 255], dtype=np.uint8) + blue = np.array([0, 0, 255, 255], dtype=np.uint8) + return (x - lmin) / lrange * blue + (lmax - x) / lrange * red .. code-block:: python # set a discrete colormap to the "sepal_width" column @table.background_colormap("sepal_width") - def f(v): - if v < 3.2: - return "green" - else: - return "purple" + def _(x: float): + return "green" if x < 3.2 else "violet" .. image:: ../fig/colormap.png