class_docstr: Configure tooltips.
  
  Notes
  -----
  Set tooltips='none' to hide tooltips from this layer.
  
  Examples
  --------
  .. jupyter-execute::
      :linenos:
      :emphasize-lines: 15
  
      import numpy as np
      from lets_plot import *
      LetsPlot.setup_html()
      n = 100
      np.random.seed(42)
      data = {
          'id': np.arange(n),
          'x': np.random.normal(size=n),
          'y': np.random.normal(size=n),
          'c': np.random.choice(['a', 'b'], size=n),
          'w': np.random.randint(1, 11, size=n)
      }
      ggplot(data, aes('x', 'y')) + \
          geom_point(aes(color='c', size='w'), \
                     tooltips=layer_tooltips().line('@c "@id"')
                                              .line('---')
                                              .format('@y', '.2f')
                                              .line('(x, y)|(^x, @y)')
                                              .line('@|@w')) + \
          scale_size(range=[2, 4])
  
  |
  
  .. jupyter-execute::
      :linenos:
      :emphasize-lines: 12
  
      import numpy as np
      from lets_plot import *
      LetsPlot.setup_html()
      n = 100
      np.random.seed(42)
      data = {
          'x': np.random.normal(size=n),
          'y': np.random.normal(size=n),
          'c': np.random.randint(10, size=n)
      }
      ggplot(data, aes('x', 'y')) + \
          geom_point(aes(color='c'), tooltips='none')
class_docstr_tok: ["Configure","tooltips",".","Notes","--","--","-","Set","tooltips='none","'","to","hide","tooltips","from","this","layer",".","Examples","--","--","--","--","..","jupyter-execute",":",":",":","linenos",":",":","emphasize-lines",":","15","import","numpy","as","np","from","lets_plot","import","*","LetsPlot.setup_html","(",")","n","=","100","np.random.seed","(","42",")","data","=","{","'id","'",":","np.arange","(","n",")",",","'","x","'",":","np.random.normal","(","size=n",")",",","'","y","'",":","np.random.normal","(","size=n",")",",","'","c","'",":","np.random.choice","(","[","'","a","'",",","'","b","'","]",",","size=n",")",",","'","w","'",":","np.random.randint","(","1",",","11",",","size=n",")","}","ggplot","(","data",",","aes","(","'","x","'",",","'","y","'",")",")","+","\\","geom_point","(","aes","(","color=","'","c","'",",","size=","'","w","'",")",",","\\","tooltips=layer_tooltips","(",")",".line","(","'","@","c","``","@","id","''","'",")",".line","(","'","--","-","'",")",".format","(","'","@","y","'",",","'.2f","'",")",".line","(","'","(","x",",","y",")","|","(","^x",",","@","y",")","'",")",".line","(","'","@","|","@","w","'",")",")","+","\\","scale_size","(","range=","[","2",",","4","]",")","|","..","jupyter-execute",":",":",":","linenos",":",":","emphasize-lines",":","12","import","numpy","as","np","from","lets_plot","import","*","LetsPlot.setup_html","(",")","n","=","100","np.random.seed","(","42",")","data","=","{","'","x","'",":","np.random.normal","(","size=n",")",",","'","y","'",":","np.random.normal","(","size=n",")",",","'","c","'",":","np.random.randint","(","10",",","size=n",")","}","ggplot","(","data",",","aes","(","'","x","'",",","'","y","'",")",")","+","\\","geom_point","(","aes","(","color=","'","c","'",")",",","tooltips='none","'",")"]
docstr: Define the format for displaying the value.
  This format will be applied to the mapped value in the default tooltip
  or to the corresponding value specified in the 'line' template.
  
  Parameters
  ----------
  field : str
      Name of an aesthetic or variable that would be formatted.
      The field name starts with a '^' prefix for aesthetics,
      the variable name starts with a '@' prefix or without any prefix.
  format : str
      Formatting specification. The format contains a number format ('1.f'),
      a string template ('{.1f}') or a date/time format ('%d.%m.%y').
      The numeric format for non-numeric value will be ignored.
      If you need to include a brace character in the literal text,
      it can be escaped by doubling: `{{` and `}}`.
  
  Returns
  -------
  `layer_tooltips`
      Layer tooltips specification.
  
  Notes
  -----
  It's possible to set the format for all positional aesthetics:
  
  - field='^X' - for all positional x,
  - field='^Y' - for all positional y.
  
  |
  
  The string template in `format` will allow to change lines
  for the default tooltip without `line` specifying.
  Also the template will change the line for side tooltips.
  Aes and var formats are not interchangeable, i.e. var format
  will not be applied to aes, mapped to this variable.
  
  |
  
  For more info see https://lets-plot.org/pages/formats.html.
  
  Examples
  --------
  .. jupyter-execute::
      :linenos:
      :emphasize-lines: 15-16, 18, 20, 22
  
      import numpy as np
      from lets_plot import *
      LetsPlot.setup_html()
      n = 100
      np.random.seed(42)
      data = {
          'a': np.random.normal(size=n),
          'b': np.random.normal(size=n),
          'c': np.random.choice(['X', 'Y'], size=n),
          'd': np.random.uniform(size=n),
          'e': np.random.randint(100, size=n)
      }
      ggplot(data, aes('a', 'b')) + \
          geom_point(aes(shape='c', size='e', color='d'), show_legend=False, \
                     tooltips=layer_tooltips().format(field='a', format='.1f')\
                                              .format('^y', '.1f')\
                                              .line('(@a, ^y)')\
                                              .format('c', '{{{}}}')\
                                              .line('@|@c')\
                                              .format('^color', '≈ {.2f}')\
                                              .line('@|^color')\
                                              .format('e', '{}%')\
                                              .line('e|@e')) + \
          scale_size(range=[2, 4])
  
  |
  
  .. jupyter-execute::
      :linenos:
      :emphasize-lines: 11-13
  
      import numpy as np
      from lets_plot import *
      LetsPlot.setup_html()
      n = 50
      np.random.seed(42)
      data = {
          'v': np.random.normal(size=n),
          'c': np.random.choice(['a', 'b', 'c'], size=n),
      }
      ggplot(data, aes('c', 'v')) + \
          geom_boxplot(tooltips=layer_tooltips().format('^Y', '.4f')\
                                                .format('^ymin', 'min y: {.2f}')\
                                                .format('^ymax', 'max y: {.2f}'))
docstr_tok: ["Define","the","format","for","displaying","the","value",".","This","format","will","be","applied","to","the","mapped","value","in","the","default","tooltip","or","to","the","corresponding","value","specified","in","the","'line","'","template",".","Parameters","--","--","--","--","--","field",":","str","Name","of","an","aesthetic","or","variable","that","would","be","formatted",".","The","field","name","starts","with","a","'^","'","prefix","for","aesthetics",",","the","variable","name","starts","with","a","'","@","'","prefix","or","without","any","prefix",".","format",":","str","Formatting","specification",".","The","format","contains","a","number","format","(","'","1.f","'",")",",","a","string","template","(","'","{",".1f","}","'",")","or","a","date\/time","format","(","'","%","d.","%","m.","%","y","'",")",".","The","numeric","format","for","non-numeric","value","will","be","ignored",".","If","you","need","to","include","a","brace","character","in","the","literal","text",",","it","can","be","escaped","by","doubling",":","`","{","{","`","and","`","}","}","`",".","Returns","--","--","--","-","`","layer_tooltips","`","Layer","tooltips","specification",".","Notes","--","--","-","It","'s","possible","to","set","the","format","for","all","positional","aesthetics",":","-","field='^X","'","-","for","all","positional","x",",","-","field='^Y","'","-","for","all","positional","y",".","|","The","string","template","in","`","format","`","will","allow","to","change","lines","for","the","default","tooltip","without","`","line","`","specifying",".","Also","the","template","will","change","the","line","for","side","tooltips",".","Aes","and","var","formats","are","not","interchangeable",",","i.e",".","var","format","will","not","be","applied","to","aes",",","mapped","to","this","variable",".","|","For","more","info","see","https",":","\/\/lets-plot.org\/pages\/formats.html",".","Examples","--","--","--","--","..","jupyter-execute",":",":",":","linenos",":",":","emphasize-lines",":","15-16",",","18",",","20",",","22","import","numpy","as","np","from","lets_plot","import","*","LetsPlot.setup_html","(",")","n","=","100","np.random.seed","(","42",")","data","=","{","'","a","'",":","np.random.normal","(","size=n",")",",","'","b","'",":","np.random.normal","(","size=n",")",",","'","c","'",":","np.random.choice","(","[","'","X","'",",","'","Y","'","]",",","size=n",")",",","'d","'",":","np.random.uniform","(","size=n",")",",","'","e","'",":","np.random.randint","(","100",",","size=n",")","}","ggplot","(","data",",","aes","(","'","a","'",",","'","b","'",")",")","+","\\","geom_point","(","aes","(","shape=","'","c","'",",","size=","'","e","'",",","color='d","'",")",",","show_legend=False",",","\\","tooltips=layer_tooltips","(",")",".format","(","field=","'","a","'",",","format='.1f","'",")","\\",".format","(","'^y","'",",","'.1f","'",")","\\",".line","(","'","(","@","a",",","^y",")","'",")","\\",".format","(","'","c","'",",","'","{","{","{","}","}","}","'",")","\\",".line","(","'","@","|","@","c","'",")","\\",".format","(","'^color","'",",","'\u2248","{",".2f","}","'",")","\\",".line","(","'","@","|^color","'",")","\\",".format","(","'","e","'",",","'","{","}","%","'",")","\\",".line","(","'","e|","@","e","'",")",")","+","\\","scale_size","(","range=","[","2",",","4","]",")","|","..","jupyter-execute",":",":",":","linenos",":",":","emphasize-lines",":","11-13","import","numpy","as","np","from","lets_plot","import","*","LetsPlot.setup_html","(",")","n","=","50","np.random.seed","(","42",")","data","=","{","'","v","'",":","np.random.normal","(","size=n",")",",","'","c","'",":","np.random.choice","(","[","'","a","'",",","'","b","'",",","'","c","'","]",",","size=n",")",",","}","ggplot","(","data",",","aes","(","'","c","'",",","'","v","'",")",")","+","\\","geom_boxplot","(","tooltips=layer_tooltips","(",")",".format","(","'^Y","'",",","'.4f","'",")","\\",".format","(","'^ymin","'",",","'min","y",":","{",".2f","}","'",")","\\",".format","(","'^ymax","'",",","'max","y",":","{",".2f","}","'",")",")"]
code: def format(self, field=None, format=None):
      """
          Define the format for displaying the value.
          This format will be applied to the mapped value in the default tooltip
          or to the corresponding value specified in the 'line' template.
  
          Parameters
          ----------
          field : str
              Name of an aesthetic or variable that would be formatted.
              The field name starts with a '^' prefix for aesthetics,
              the variable name starts with a '@' prefix or without any prefix.
          format : str
              Formatting specification. The format contains a number format ('1.f'),
              a string template ('{.1f}') or a date/time format ('%d.%m.%y').
              The numeric format for non-numeric value will be ignored.
              If you need to include a brace character in the literal text,
              it can be escaped by doubling: `{{` and `}}`.
  
          Returns
          -------
          `layer_tooltips`
              Layer tooltips specification.
  
          Notes
          -----
          It's possible to set the format for all positional aesthetics:
  
          - field='^X' - for all positional x,
          - field='^Y' - for all positional y.
  
          |
  
          The string template in `format` will allow to change lines
          for the default tooltip without `line` specifying.
          Also the template will change the line for side tooltips.
          Aes and var formats are not interchangeable, i.e. var format
          will not be applied to aes, mapped to this variable.
  
          |
  
          For more info see https://lets-plot.org/pages/formats.html.
  
          Examples
          --------
          .. jupyter-execute::
              :linenos:
              :emphasize-lines: 15-16, 18, 20, 22
  
              import numpy as np
              from lets_plot import *
              LetsPlot.setup_html()
              n = 100
              np.random.seed(42)
              data = {
                  'a': np.random.normal(size=n),
                  'b': np.random.normal(size=n),
                  'c': np.random.choice(['X', 'Y'], size=n),
                  'd': np.random.uniform(size=n),
                  'e': np.random.randint(100, size=n)
              }
              ggplot(data, aes('a', 'b')) + \\
                  geom_point(aes(shape='c', size='e', color='d'), show_legend=False, \\
                             tooltips=layer_tooltips().format(field='a', format='.1f')\\
                                                      .format('^y', '.1f')\\
                                                      .line('(@a, ^y)')\\
                                                      .format('c', '{{{}}}')\\
                                                      .line('@|@c')\\
                                                      .format('^color', '≈ {.2f}')\\
                                                      .line('@|^color')\\
                                                      .format('e', '{}%')\\
                                                      .line('e|@e')) + \\
                  scale_size(range=[2, 4])
  
          |
  
          .. jupyter-execute::
              :linenos:
              :emphasize-lines: 11-13
  
              import numpy as np
              from lets_plot import *
              LetsPlot.setup_html()
              n = 50
              np.random.seed(42)
              data = {
                  'v': np.random.normal(size=n),
                  'c': np.random.choice(['a', 'b', 'c'], size=n),
              }
              ggplot(data, aes('c', 'v')) + \\
                  geom_boxplot(tooltips=layer_tooltips().format('^Y', '.4f')\\
                                                        .format('^ymin', 'min y: {.2f}')\\
                                                        .format('^ymax', 'max y: {.2f}'))
  
          """
      self._tooltip_formats.append({"field": field, "format": format})
      return self
  
file_path: lets-plot/python-package/lets_plot/plot/tooltip.py
imports: from typing import List
  from lets_plot.plot.core import FeatureSpec, _filter_none
label_desc: Use image node_id 3 for calling the layer_tooltips obj's underlying member method code with example usage: obj.format(field, format) and returns: self