@@ -3740,48 +3740,77 @@ def to_image(self, *args, **kwargs):
3740
3740
- 'webp'
3741
3741
- 'svg'
3742
3742
- 'pdf'
3743
- - 'eps' (Requires the poppler library to be installed)
3743
+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
3744
3744
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)
3746
3748
3747
3749
width: int or None
3748
3750
The width of the exported image in layout pixels. If the `scale`
3749
3751
property is 1.0, this will also be the width of the exported image
3750
3752
in physical pixels.
3751
3753
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)
3753
3757
3754
3758
height: int or None
3755
3759
The height of the exported image in layout pixels. If the `scale`
3756
3760
property is 1.0, this will also be the height of the exported image
3757
3761
in physical pixels.
3758
3762
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)
3760
3766
3761
3767
scale: int or float or None
3762
3768
The scale factor to use when exporting the figure. A scale factor
3763
3769
larger than 1.0 will increase the image resolution with respect
3764
3770
to the figure's layout pixel dimensions. Whereas as scale factor of
3765
3771
less than 1.0 will decrease the image resolution.
3766
3772
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)
3768
3776
3769
3777
validate: bool
3770
3778
True if the figure should be validated before being converted to
3771
3779
an image, False otherwise.
3772
3780
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
3778
3787
3779
3788
Returns
3780
3789
-------
3781
3790
bytes
3782
3791
The image data
3783
3792
"""
3784
3793
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
+ )
3785
3814
3786
3815
return pio .to_image (self , * args , ** kwargs )
3787
3816
@@ -3803,49 +3832,78 @@ def write_image(self, *args, **kwargs):
3803
3832
- 'webp'
3804
3833
- 'svg'
3805
3834
- 'pdf'
3806
- - 'eps' (Requires the poppler library to be installed)
3835
+ - 'eps' (deprecated) ( Requires the poppler library to be installed)
3807
3836
3808
3837
If not specified and `file` is a string then this will default to the
3809
3838
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)
3811
3842
3812
3843
width: int or None
3813
3844
The width of the exported image in layout pixels. If the `scale`
3814
3845
property is 1.0, this will also be the width of the exported image
3815
3846
in physical pixels.
3816
3847
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)
3818
3851
3819
3852
height: int or None
3820
3853
The height of the exported image in layout pixels. If the `scale`
3821
3854
property is 1.0, this will also be the height of the exported image
3822
3855
in physical pixels.
3823
3856
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)
3825
3860
3826
3861
scale: int or float or None
3827
3862
The scale factor to use when exporting the figure. A scale factor
3828
3863
larger than 1.0 will increase the image resolution with respect
3829
3864
to the figure's layout pixel dimensions. Whereas as scale factor of
3830
3865
less than 1.0 will decrease the image resolution.
3831
3866
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)
3833
3870
3834
3871
validate: bool
3835
3872
True if the figure should be validated before being converted to
3836
3873
an image, False otherwise.
3837
3874
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
+
3843
3882
Returns
3844
3883
-------
3845
3884
None
3846
3885
"""
3847
3886
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
+ )
3848
3894
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
+ )
3849
3907
return pio .write_image (self , * args , ** kwargs )
3850
3908
3851
3909
# Static helpers
0 commit comments