@@ -3718,48 +3718,77 @@ def to_image(self, *args, **kwargs):
3718
3718
- 'webp'
3719
3719
- 'svg'
3720
3720
- 'pdf'
3721
- - 'eps' (Requires the poppler library to be installed)
3721
+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
3722
3722
3723
- If not specified, will default to `plotly.io.config.default_format`
3723
+ If not specified, will default to:
3724
+ - `plotly.io.defaults.default_format` if engine is "kaleido"
3725
+ - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
3724
3726
3725
3727
width: int or None
3726
3728
The width of the exported image in layout pixels. If the `scale`
3727
3729
property is 1.0, this will also be the width of the exported image
3728
3730
in physical pixels.
3729
3731
3730
- If not specified, will default to `plotly.io.config.default_width`
3732
+ If not specified, will default to:
3733
+ - `plotly.io.defaults.default_width` if engine is "kaleido"
3734
+ - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
3731
3735
3732
3736
height: int or None
3733
3737
The height of the exported image in layout pixels. If the `scale`
3734
3738
property is 1.0, this will also be the height of the exported image
3735
3739
in physical pixels.
3736
3740
3737
- If not specified, will default to `plotly.io.config.default_height`
3741
+ If not specified, will default to:
3742
+ - `plotly.io.defaults.default_height` if engine is "kaleido"
3743
+ - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
3738
3744
3739
3745
scale: int or float or None
3740
3746
The scale factor to use when exporting the figure. A scale factor
3741
3747
larger than 1.0 will increase the image resolution with respect
3742
3748
to the figure's layout pixel dimensions. Whereas as scale factor of
3743
3749
less than 1.0 will decrease the image resolution.
3744
3750
3745
- If not specified, will default to `plotly.io.config.default_scale`
3751
+ If not specified, will default to:
3752
+ - `plotly.io.defaults.default_scale` if engine is "kaliedo"
3753
+ - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
3746
3754
3747
3755
validate: bool
3748
3756
True if the figure should be validated before being converted to
3749
3757
an image, False otherwise.
3750
3758
3751
- engine: str
3752
- Image export engine to use:
3753
- - "kaleido": Use Kaleido for image export
3754
- - "orca": Use Orca for image export
3755
- - "auto" (default): Use Kaleido if installed, otherwise use orca
3759
+ engine (deprecated): str
3760
+ Image export engine to use. This parameter is deprecated and Orca engine support will be
3761
+ dropped in the next major Plotly version. Until then, the following values are supported:
3762
+ - "kaleido": Use Kaleido for image export
3763
+ - "orca": Use Orca for image export
3764
+ - "auto" (default): Use Kaleido if installed, otherwise use Orca
3756
3765
3757
3766
Returns
3758
3767
-------
3759
3768
bytes
3760
3769
The image data
3761
3770
"""
3762
3771
import plotly .io as pio
3772
+ from plotly .io .kaleido import (
3773
+ kaleido_available ,
3774
+ kaleido_major ,
3775
+ KALEIDO_DEPRECATION_MSG ,
3776
+ ORCA_DEPRECATION_MSG ,
3777
+ ENGINE_PARAM_DEPRECATION_MSG ,
3778
+ )
3779
+
3780
+ if (
3781
+ kwargs .get ("engine" , None ) in {None , "auto" , "kaleido" }
3782
+ and kaleido_available ()
3783
+ and kaleido_major () < 1
3784
+ ):
3785
+ warnings .warn (KALEIDO_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3786
+ if kwargs .get ("engine" , None ) == "orca" :
3787
+ warnings .warn (ORCA_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3788
+ if kwargs .get ("engine" , None ):
3789
+ warnings .warn (
3790
+ ENGINE_PARAM_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2
3791
+ )
3763
3792
3764
3793
return pio .to_image (self , * args , ** kwargs )
3765
3794
@@ -3781,49 +3810,78 @@ def write_image(self, *args, **kwargs):
3781
3810
- 'webp'
3782
3811
- 'svg'
3783
3812
- 'pdf'
3784
- - 'eps' (Requires the poppler library to be installed)
3813
+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
3785
3814
3786
3815
If not specified and `file` is a string then this will default to the
3787
3816
file extension. If not specified and `file` is not a string then this
3788
- will default to `plotly.io.config.default_format`
3817
+ will default to:
3818
+ - `plotly.io.defaults.default_format` if engine is "kaleido"
3819
+ - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated)
3789
3820
3790
3821
width: int or None
3791
3822
The width of the exported image in layout pixels. If the `scale`
3792
3823
property is 1.0, this will also be the width of the exported image
3793
3824
in physical pixels.
3794
3825
3795
- If not specified, will default to `plotly.io.config.default_width`
3826
+ If not specified, will default to:
3827
+ - `plotly.io.defaults.default_width` if engine is "kaleido"
3828
+ - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated)
3796
3829
3797
3830
height: int or None
3798
3831
The height of the exported image in layout pixels. If the `scale`
3799
3832
property is 1.0, this will also be the height of the exported image
3800
3833
in physical pixels.
3801
3834
3802
- If not specified, will default to `plotly.io.config.default_height`
3835
+ If not specified, will default to:
3836
+ - `plotly.io.defaults.default_height` if engine is "kaleido"
3837
+ - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated)
3803
3838
3804
3839
scale: int or float or None
3805
3840
The scale factor to use when exporting the figure. A scale factor
3806
3841
larger than 1.0 will increase the image resolution with respect
3807
3842
to the figure's layout pixel dimensions. Whereas as scale factor of
3808
3843
less than 1.0 will decrease the image resolution.
3809
3844
3810
- If not specified, will default to `plotly.io.config.default_scale`
3845
+ If not specified, will default to:
3846
+ - `plotly.io.defaults.default_scale` if engine is "kaleido"
3847
+ - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated)
3811
3848
3812
3849
validate: bool
3813
3850
True if the figure should be validated before being converted to
3814
3851
an image, False otherwise.
3815
3852
3816
- engine: str
3817
- Image export engine to use:
3818
- - "kaleido": Use Kaleido for image export
3819
- - "orca": Use Orca for image export
3820
- - "auto" (default): Use Kaleido if installed, otherwise use orca
3853
+ engine (deprecated): str
3854
+ Image export engine to use. This parameter is deprecated and Orca engine support will be
3855
+ dropped in the next major Plotly version. Until then, the following values are supported:
3856
+ - "kaleido": Use Kaleido for image export
3857
+ - "orca": Use Orca for image export
3858
+ - "auto" (default): Use Kaleido if installed, otherwise use Orca
3859
+
3821
3860
Returns
3822
3861
-------
3823
3862
None
3824
3863
"""
3825
3864
import plotly .io as pio
3865
+ from plotly .io .kaleido import (
3866
+ kaleido_available ,
3867
+ kaleido_major ,
3868
+ KALEIDO_DEPRECATION_MSG ,
3869
+ ORCA_DEPRECATION_MSG ,
3870
+ ENGINE_PARAM_DEPRECATION_MSG ,
3871
+ )
3826
3872
3873
+ if (
3874
+ kwargs .get ("engine" , None ) in {None , "auto" , "kaleido" }
3875
+ and kaleido_available ()
3876
+ and kaleido_major () < 1
3877
+ ):
3878
+ warnings .warn (KALEIDO_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3879
+ if kwargs .get ("engine" , None ) == "orca" :
3880
+ warnings .warn (ORCA_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2 )
3881
+ if kwargs .get ("engine" , None ):
3882
+ warnings .warn (
3883
+ ENGINE_PARAM_DEPRECATION_MSG , DeprecationWarning , stacklevel = 2
3884
+ )
3827
3885
return pio .write_image (self , * args , ** kwargs )
3828
3886
3829
3887
# Static helpers
0 commit comments