@@ -3740,48 +3740,77 @@ def to_image(self, *args, **kwargs):
37403740 - 'webp'
37413741 - 'svg'
37423742 - 'pdf'
3743- - 'eps' (Requires the poppler library to be installed)
3743+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
37443744
3745- If not specified, will default to `plotly.io.config.default_format`
3745+ If not specified, will default to:
3746+ - `plotly.io.defaults.default_format` if engine is "kaleido"
3747+ - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
37463748
37473749 width: int or None
37483750 The width of the exported image in layout pixels. If the `scale`
37493751 property is 1.0, this will also be the width of the exported image
37503752 in physical pixels.
37513753
3752- If not specified, will default to `plotly.io.config.default_width`
3754+ If not specified, will default to:
3755+ - `plotly.io.defaults.default_width` if engine is "kaleido"
3756+ - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
37533757
37543758 height: int or None
37553759 The height of the exported image in layout pixels. If the `scale`
37563760 property is 1.0, this will also be the height of the exported image
37573761 in physical pixels.
37583762
3759- If not specified, will default to `plotly.io.config.default_height`
3763+ If not specified, will default to:
3764+ - `plotly.io.defaults.default_height` if engine is "kaleido"
3765+ - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
37603766
37613767 scale: int or float or None
37623768 The scale factor to use when exporting the figure. A scale factor
37633769 larger than 1.0 will increase the image resolution with respect
37643770 to the figure's layout pixel dimensions. Whereas as scale factor of
37653771 less than 1.0 will decrease the image resolution.
37663772
3767- If not specified, will default to `plotly.io.config.default_scale`
3773+ If not specified, will default to:
3774+ - `plotly.io.defaults.default_scale` if engine is "kaliedo"
3775+ - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
37683776
37693777 validate: bool
37703778 True if the figure should be validated before being converted to
37713779 an image, False otherwise.
37723780
3773- engine: str
3774- Image export engine to use:
3775- - "kaleido": Use Kaleido for image export
3776- - "orca": Use Orca for image export
3777- - "auto" (default): Use Kaleido if installed, otherwise use orca
3781+ engine (deprecated): str
3782+ Image export engine to use. This parameter is deprecated and Orca engine support will be
3783+ dropped in the next major Plotly version. Until then, the following values are supported:
3784+ - "kaleido": Use Kaleido for image export
3785+ - "orca": Use Orca for image export
3786+ - "auto" (default): Use Kaleido if installed, otherwise use Orca
37783787
37793788 Returns
37803789 -------
37813790 bytes
37823791 The image data
37833792 """
37843793 import plotly .io as pio
3794+ from plotly .io .kaleido import (
3795+ kaleido_available ,
3796+ kaleido_major ,
3797+ KALEIDO_DEPRECATION_MSG ,
3798+ ORCA_DEPRECATION_MSG ,
3799+ ENGINE_PARAM_DEPRECATION_MSG ,
3800+ )
3801+
3802+ if (
3803+ kwargs .get ("engine" , None ) in {None , "auto" , "kaleido" }
3804+ and kaleido_available ()
3805+ and kaleido_major () < 1
3806+ ):
3807+ warnings .warn (KALEIDO_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3808+ if kwargs .get ("engine" , None ) == "orca" :
3809+ warnings .warn (ORCA_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3810+ if kwargs .get ("engine" , None ):
3811+ warnings .warn (
3812+ ENGINE_PARAM_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2
3813+ )
37853814
37863815 return pio .to_image (self , * args , ** kwargs )
37873816
@@ -3803,49 +3832,78 @@ def write_image(self, *args, **kwargs):
38033832 - 'webp'
38043833 - 'svg'
38053834 - 'pdf'
3806- - 'eps' (Requires the poppler library to be installed)
3835+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
38073836
38083837 If not specified and `file` is a string then this will default to the
38093838 file extension. If not specified and `file` is not a string then this
3810- will default to `plotly.io.config.default_format`
3839+ will default to:
3840+ - `plotly.io.defaults.default_format` if engine is "kaleido"
3841+ - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
38113842
38123843 width: int or None
38133844 The width of the exported image in layout pixels. If the `scale`
38143845 property is 1.0, this will also be the width of the exported image
38153846 in physical pixels.
38163847
3817- If not specified, will default to `plotly.io.config.default_width`
3848+ If not specified, will default to:
3849+ - `plotly.io.defaults.default_width` if engine is "kaleido"
3850+ - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
38183851
38193852 height: int or None
38203853 The height of the exported image in layout pixels. If the `scale`
38213854 property is 1.0, this will also be the height of the exported image
38223855 in physical pixels.
38233856
3824- If not specified, will default to `plotly.io.config.default_height`
3857+ If not specified, will default to:
3858+ - `plotly.io.defaults.default_height` if engine is "kaleido"
3859+ - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
38253860
38263861 scale: int or float or None
38273862 The scale factor to use when exporting the figure. A scale factor
38283863 larger than 1.0 will increase the image resolution with respect
38293864 to the figure's layout pixel dimensions. Whereas as scale factor of
38303865 less than 1.0 will decrease the image resolution.
38313866
3832- If not specified, will default to `plotly.io.config.default_scale`
3867+ If not specified, will default to:
3868+ - `plotly.io.defaults.default_scale` if engine is "kaleido"
3869+ - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
38333870
38343871 validate: bool
38353872 True if the figure should be validated before being converted to
38363873 an image, False otherwise.
38373874
3838- engine: str
3839- Image export engine to use:
3840- - "kaleido": Use Kaleido for image export
3841- - "orca": Use Orca for image export
3842- - "auto" (default): Use Kaleido if installed, otherwise use orca
3875+ engine (deprecated): str
3876+ Image export engine to use. This parameter is deprecated and Orca engine support will be
3877+ dropped in the next major Plotly version. Until then, the following values are supported:
3878+ - "kaleido": Use Kaleido for image export
3879+ - "orca": Use Orca for image export
3880+ - "auto" (default): Use Kaleido if installed, otherwise use Orca
3881+
38433882 Returns
38443883 -------
38453884 None
38463885 """
38473886 import plotly .io as pio
3887+ from plotly .io .kaleido import (
3888+ kaleido_available ,
3889+ kaleido_major ,
3890+ KALEIDO_DEPRECATION_MSG ,
3891+ ORCA_DEPRECATION_MSG ,
3892+ ENGINE_PARAM_DEPRECATION_MSG ,
3893+ )
38483894
3895+ if (
3896+ kwargs .get ("engine" , None ) in {None , "auto" , "kaleido" }
3897+ and kaleido_available ()
3898+ and kaleido_major () < 1
3899+ ):
3900+ warnings .warn (KALEIDO_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3901+ if kwargs .get ("engine" , None ) == "orca" :
3902+ warnings .warn (ORCA_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3903+ if kwargs .get ("engine" , None ):
3904+ warnings .warn (
3905+ ENGINE_PARAM_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2
3906+ )
38493907 return pio .write_image (self , * args , ** kwargs )
38503908
38513909 # Static helpers
0 commit comments