### Creating and Customizing a Basic PlotlyLight Plot in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/README.md This snippet demonstrates the quickstart process for creating and customizing a plot using PlotlyLight.jl. It initializes the package, applies a dark theme, generates a scatter plot with random data, and then modifies the plot's title. The final line `p` implicitly displays the plot in an interactive Julia environment. ```Julia using PlotlyLight preset.template.plotly_dark!() # Change template p = plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers") # Make plot p.layout.title.text = "My Title!" # Make changes p # `display(p)` to see the updated plot ``` -------------------------------- ### Creating and Customizing a Basic PlotlyLight Plot in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/index.md This snippet demonstrates the quickstart workflow for PlotlyLight.jl. It shows how to import the library, apply a built-in dark theme, create a basic scatter plot with data, modify a layout property (the title), and then re-display the plot to reflect the changes. It highlights the direct manipulation of plot properties. ```Julia using PlotlyLight # Change template preset.template.plotly_dark!() # Make Plot p = plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers") # Make changes p.layout.title.text = "My Title!" # Re-display to see updated plot p ``` -------------------------------- ### Chaining Multiple Traces in PlotlyLight (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/plotly_basics.md This example illustrates how PlotlyLight allows chaining multiple trace definitions using dot syntax. It first generates a random dataset `y` and then creates a plot that combines a bar trace and a scatter trace for the same data. This chaining mechanism provides a concise way to overlay different visualizations on a single plot. ```Julia using PlotlyLight # hide y = randn(20) plot.bar(; y).scatter(; y) ``` -------------------------------- ### Saving PlotlyLight.jl Plots as Image using PlotlyKaleido.jl in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/saving.md This snippet illustrates how to save a PlotlyLight.jl plot as an image (e.g., PNG) using the PlotlyKaleido.jl package. It requires starting the Kaleido engine, extracting the `data`, `layout`, and `config` components from the PlotlyLight plot object `p`, and then using `PlotlyKaleido.savefig` to render and save the image. ```Julia using PlotlyKaleido PlotlyKaleido.start() (;data, layout, config) = p PlotlyKaleido.savefig((; data, layout, config), "myplot.png") ``` -------------------------------- ### Creating a Sample Bar Plot (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet creates a basic bar plot using `PlotlyLight.plot.bar` with random data. This plot will be used as a base to demonstrate the visual effects of applying different templates throughout the document. ```Julia plt = plot.bar(y = randn(10)) nothing # hide ``` -------------------------------- ### Listing Available PlotlyLight Templates (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet imports the PlotlyLight package and then lists all available preset templates by inspecting the `PlotlyLight.preset.template` object. This is useful for discovering the names of built-in templates that can be applied to plots. ```Julia using PlotlyLight keys(PlotlyLight.preset.template) ``` -------------------------------- ### Exploring Trace Types with Tab Completion in PlotlyLight (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/plotly_basics.md This snippet demonstrates how to use tab auto-completion on the `plot` function in PlotlyLight to discover available trace types. It shows a comprehensive list of supported trace types like 'bar', 'scatter', 'box', etc., which can be used to define how data is visualized. This feature aids in quickly exploring plotting options without needing to consult external documentation. ```Julia julia> plot. # bar barpolar box candlestick # carpet choropleth choroplethmapbox cone # contour contourcarpet densitymapbox funnel # funnelarea heatmap heatmapgl histogram # histogram2d histogram2dcontour icicle image # indicator isosurface mesh3d ohlc # parcats parcoords pie pointcloud # sankey scatter scatter3d scattercarpet # scattergeo scattergl scattermapbox scatterpolar # scatterpolargl scattersmith scatterternary splom # streamtube sunburst surface table # treemap violin volume waterfall ``` -------------------------------- ### Configuring PlotlyLight.jl Settings in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/settings.md This snippet outlines the various user-configurable settings available within the `PlotlyLight.settings` object. These settings allow fine-grained control over how Plotly.js is loaded, the plot's HTML structure, default plot layouts and configurations, REPL display behavior, and the injection of custom CSS or scripts into the generated HTML. ```Julia settings.src::Cobweb.Node # plotly.js script loader settings.div::Cobweb.Node # The plot-div settings.layout::EasyConfig.Config # default `layout` for all plots settings.config::EasyConfig.Config # default `config` for all plots settings.reuse_preview::Bool # In the REPL, open plots in same page (true, the default) or different pages. settings.page_css::Cobweb.Node # CSS to inject at the top of the page settings.use_iframe::Bool # Use an iframe to display the plot (default=false) settings.iframe_style::String # style attributes for the iframe settings.src_inject::Vector # Code (typically scripts) to inject into the html ``` -------------------------------- ### Creating and Applying a Custom PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet demonstrates how to create a custom template by defining a `Config` object and setting its layout properties, such as the plot title. The custom template is then applied globally by assigning it to `PlotlyLight.settings.layout.template`, affecting all subsequent plots. ```Julia my_template = Config() my_template.layout.title.text = "This Title Will be in Every Plot!" PlotlyLight.settings.layout.template = my_template plt # hide ``` -------------------------------- ### Configuring Plotly.js Source Loading in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/source.md This snippet demonstrates how to configure the source of the Plotly.js script when generating HTML output using the `plotlylight.jl` library. It provides options to control whether the script is included, loaded from a CDN, a local file, or embedded directly into the HTML. ```julia preset.source.none!() # Don't include the script. preset.source.cdn!() # Use the official plotly.js CDN. preset.source.local!() # Use a local version of the plotly.js script. preset.source.standalone!() # Copy-paste the plotly.js script into the html output. ``` -------------------------------- ### Applying 'seaborn' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'seaborn' template, which emulates the distinctive statistical plotting style of the Seaborn library in Python. It provides a visually appealing and informative default aesthetic for statistical graphics. ```Julia preset.template.seaborn!() plt # hide ``` -------------------------------- ### Applying 'simple_white' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'simple_white' template, offering a clean, minimalist white background with minimal grid lines. This template is ideal for plots where a stark, uncluttered appearance is desired. ```Julia preset.template.simple_white!() plt # hide ``` -------------------------------- ### Applying 'presentation' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'presentation' template, which optimizes the plot's appearance for presentations. This often involves larger fonts, thicker lines, and clearer visual elements to ensure visibility on larger screens. ```Julia preset.template.presentation!() plt # hide ``` -------------------------------- ### Applying 'plotly_white' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'plotly_white' template, which provides a light-themed aesthetic, similar to the default but explicitly white. It ensures a clean, bright background for the plot. ```Julia preset.template.plotly_white!() plt # hide ``` -------------------------------- ### Applying 'plotly' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the default 'plotly' template, which restores the standard Plotly styling to the plot. This template represents the typical appearance of plots generated directly by the Plotly library. ```Julia preset.template.plotly!() plt # hide ``` -------------------------------- ### Applying 'none' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'none' template to the previously created plot. The 'none' template typically removes all default styling, resulting in a very minimalist plot with minimal visual elements. ```Julia preset.template.none!() plt # hide ``` -------------------------------- ### Applying 'gridon' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'gridon' template, which specifically enables grid lines on the plot. This can enhance readability by providing visual cues for data points and their corresponding axis values. ```Julia preset.template.gridon!() plt # hide ``` -------------------------------- ### Applying 'plotly_dark' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'plotly_dark' template, which provides a dark-themed aesthetic suitable for dark mode applications or presentations. It typically features light-colored elements on a dark background. ```Julia preset.template.plotly_dark!() plt # hide ``` -------------------------------- ### Saving PlotlyLight.jl Plots as HTML in Julia Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/saving.md This snippet demonstrates how to save a PlotlyLight.jl plot object `p` as an HTML file. The `PlotlyLight.save` function takes the plot object and the desired filename as arguments, creating an interactive HTML visualization. For offline viewing, ensure `PlotlyLight.preset.source.standalone!()` is called beforehand. ```Julia p = plot(y=rand(10)) PlotlyLight.save(p, "myplot.html") ``` -------------------------------- ### Applying 'ggplot2' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'ggplot2' template to the plot. This template mimics the distinctive aesthetic style of plots generated by the ggplot2 library in R, providing a familiar look for users accustomed to that visualization package. ```Julia preset.template.ggplot2!() plt # hide ``` -------------------------------- ### Applying 'xgridoff' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'xgridoff' template, which specifically disables grid lines along the x-axis. This can be useful for certain visual preferences or when the x-axis grid lines are deemed unnecessary for clarity. ```Julia preset.template.xgridoff!() plt # hide ``` -------------------------------- ### Applying 'ygridoff' PlotlyLight Template (Julia) Source: https://github.com/juliacomputing/plotlylight.jl/blob/master/docs/src/templates.md This snippet applies the 'ygridoff' template, which specifically disables grid lines along the y-axis. This can be useful for certain visual preferences or when the y-axis grid lines are deemed unnecessary for clarity. ```Julia preset.template.ygridoff!() plt # hide ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.