Class MakePlot#
Defined in File PlotlyMakePlot.py
Class Documentation#
- class MakePlot#
A MakePlot class for Plotly. This class wraps common Plotly functions to ease figure creation.
Public Functions
- __init__(self, StrArrayLike xlabs, StrArrayLike ylabs, Optional[StrArrayLike] titles=None, Optional[StrArrayLike] zlabs=None)#
This function initializes the plot/subplots based on the inputs provided. Parameters ---------- xlabs: StrArrayLike The x-axes labels for the plots ylabs: StrArrayLike The y-axes labels for the plots titles: StrArrayLike, optional The titles for the plots. (Default value = None) zlabs: StrArrayLike, optional The z-axes labels of for the plots. Setting this forces subplots to be 3D. (Default value = None)
- Surface(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly surface on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional Keyword arguments passed on to plotly.graphic_objects.Surface Returns ------- surf : plotly.graph_objects.Surface
- Scatter3d(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a 3d plotly scatter on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graphic_objects.Scatter3d Returns ------- scatter : plotly.graph_objects.Scatter3d
- Scatter(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly scatter on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graph_objects.Scatter Returns ------- scatter : plotly.graphic_objects.Scatter
- Histogram(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly histogram on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graph_objects.Histogram Returns ------- hist : plotly.graphic_objects.Histogram
- Contour(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly contour on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graphic_objects.Contour Returns ------- contour : plotly.graph_objects.Contour
- Box(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly box on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graph_objects.Box Returns ------- box : plotly.graphic_objects.Box
- Violin(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly violin on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graph_objects.Violin Returns ------- violin : plotly.graphic_objects.Violin
- Volume(self, Optional[uint] row=None, Optional[uint] col=None, **kwargs)#
Creates a plotly volume on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) **kwargs : dict, optional keyword arguments passed on to plotly.graph_objects.Volume Returns ------- volume : plotly.graphic_objects.Volume
- show(self, **kwargs)#
Calls the figure's show method. Parameters ---------- **kwargs : dict, optional keyword arguments passed on to fig.show
- save(self, Path fileName, bool tight=True, Literal["pdf", "jpg", "png", "svg", "eps", "html", None] fileType=None, **kwargs)#
Saves the figure using the type specified. If HTML is specified, the figure will be saved as a dynamic html file. All other file types are static. Parameters ---------- fileName : Path File name to save the figure as. tight : boolean, optional If the fileType is pdf or png and this value is true, then a tool is used to eliminate whitespace. pdfCropMargins is used for PDFs and PIL is used for png's. (Default value = True) fileType : Literal["pdf","jpg","png","svg","eps","html",None], optional File suffix to use. If None, then the suffix will be inferred from the suffix of the fileName. (Default value = None) **kwargs : dict, optional Keyword arguments passed onto fig.write_image or fig.write_html, depending on fileType.
- UploadToPlotly(self, str username, str apiKey, str fileName, bool autoOpen=False)#
Upload your plot to Plotly. Parameters ---------- username : str Plotly username apiKey : str Plotly api_key fileName : str Name of the file to save the plot as. autoOpen : bool, optional If true, plot will open in browser after saving. (Default value = False)
- view(self, float azimuth, float elevation, Optional[uint] row=None, Optional[uint] col=None, Optional[float] viewDistance=None)#
Change the view on the subplot specified by row and col or on the main figure if not using subplots. Parameters ---------- azimuth : float Azimuth value in degrees elevation : float Elevation value in degrees row : Optional[uint] Subplot row (Default value = None) col : Optional[uint] Subplot column (Default value = None) viewDistance : Optional[float] Distance from camera to plot. (Default value = self.viewDistance)
- FullScreen(self)#
Make the plot full screen.
- PartScreen(self, float width, float height, Literal["in", "mm", "px"] units="in")#
Make the plot size equal to width x height. Parameters ---------- width : float Width of the plot height : float Height of the plot units : Literal["in","mm","px"], optional Units width and height are given in. (Default value = inches)
- NormalizeColorScale(self, list[str] types=[], Optional[str] data=None, Optional[float] cmax=None, Optional[float] cmin=None)#
Normalizes the color scale for the plots whose type is in the types list. If cmax and/or cmin are given, then the data variable is not used, and all plots whose type is in the types list are assigned that cmax/cmin value. If cmax and cmin are not specified, then they are set by taking the max and min of the data that matches the data variable in all plots whose type is in the typpes list. Parameters ---------- types: list[str] Plot types to set cmax and cmin for. data: Optional[str] Data type to use to calculate cmax and cmin if not already specified. (Default value = None) cmax: Optional[float] cmax value to use when setting the colorscale cmin: Optional[float] cmin value to use when setting the colorscale