### Install and load TextPlots.jl Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Use the Julia package manager to add the library and load it into the current session. ```julia julia> Pkg.add("TextPlots") julia> using TextPlots ``` -------------------------------- ### Plotting with start and stop integers Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Alternative syntax for defining the plot range using separate start and stop integers, compatible with Gadfly.jl conventions. ```julia julia> plot(x -> x^3 - 2x^2 + 3x, -5, 5) ``` -------------------------------- ### Plotting functions in the terminal Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Basic usage of the plot function with anonymous functions, named functions, and multiple functions. These examples demonstrate how to visualize mathematical functions within a specified range. ```julia julia> plot(x -> cos(x), -1:1) ``` ```julia julia> plot(sin, -5:5) ``` ```julia julia> plot([x -> cos(x), x -> cos(x + pi)], 0:5) ``` -------------------------------- ### Plot a Function Over a Range Source: https://context7.com/sunetos/textplots.jl/llms.txt Use the `plot` function to visualize mathematical functions. Specify the function and an optional range. Defaults to a range of -10:10 if not provided. Can accept start and stop values. ```julia using TextPlots # Plot a function with an anonymous lambda and range plot(x -> cos(x), -1:1) # Plot a named function (uses function name as label) plot(sin, -5:5) # Plot without specifying range (defaults to -10:10) plot(cos) # Plot with separate start and stop values (Gadfly-compatible) plot(x -> x^3 - 2x^2 + 3x, -5, 5) ``` -------------------------------- ### Configuration Parameters Reference Source: https://context7.com/sunetos/textplots.jl/llms.txt Complete list of keyword arguments available for the `plot` function with their default values and descriptions. ```APIDOC ## Configuration Parameters Reference ### Description Complete list of keyword arguments available for the `plot` function with their default values and descriptions. ### Method `plot` (keyword arguments) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Example usage of configuration parameters: plot(x -> x^2, -5:5, border=true, title="Quadratic Function", labels=true, margin=8, cols=60, rows=20, gridlines=false, invert=false) ``` ### Response #### Success Response (200) Plots are rendered with the specified configuration parameters. #### Response Example (Terminal output will reflect the applied configurations.) ### Configuration Parameters: - **border** (Bool): Whether to draw a border around the plot. Default: `true`. - **title** (Bool or String): Whether to display the title (derived from function name or provided as String). Default: `true`. - **labels** (Bool): Whether to display axis labels and values. Default: `true`. - **margin** (Int): Left padding for the plot area. Default: `8`. - **cols** (Int): Width of the plot in characters. Default: `70`. - **rows** (Int): Height of the plot in characters. Default: `20`. - **gridlines** (Bool): Whether to draw grid lines. Default: `false`. - **invert** (Bool): Whether to invert the color scheme (swap filled/empty Braille characters). Default: `false`. ``` -------------------------------- ### Plotting Cosine Function with Margin Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Demonstrates plotting the cosine function with a specified margin. Floating point numbers are automatically rounded to fit the margin. ```julia plot(cos, margin=4, cols=12, rows=6) ``` -------------------------------- ### Configuring plot dimensions and margins Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Customize the plot layout by specifying the number of columns, rows, and margin size. ```julia plot(cos, margin=16, cols=80, rows=30) ``` -------------------------------- ### plot - Display Options Source: https://context7.com/sunetos/textplots.jl/llms.txt Customize plot appearance with keyword arguments for border, title, labels, dimensions, and visual effects. ```APIDOC ## plot - Display Options ### Description Customize plot appearance with keyword arguments for border, title, labels, dimensions, and visual effects. ### Method `plot` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Disable border for cleaner output plot(x -> cos(x), border=false) # Disable all decorations for minimal output plot(x -> cos(x), border=false, title=false, labels=false) # Customize dimensions: cols (width), rows (height), margin (left padding) plot(cos, margin=16, cols=80, rows=30) # Compact plot with minimal dimensions plot(cos, margin=4, cols=12, rows=6) # Enable grid lines for reference plot(sinpi, -2, 2, gridlines=true) # Invert colors (swap filled/empty dots) plot(sinpi, -2, 2, invert=true) # Combine options plot(sinpi, -2, 2, invert=true, gridlines=true) ``` ### Response #### Success Response (200) Plots are rendered with specified display options. #### Response Example ``` # Output example with border=false: # cos(x) # 1 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠊⠉⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠊⠑⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠉⠑⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ # -0.99582 ⠡⣀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠡⣀⡐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢂⣀⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢂⣀⠌ # -10 10 ``` ``` -------------------------------- ### plot - Multiple Functions Source: https://context7.com/sunetos/textplots.jl/llms.txt Plot multiple functions simultaneously by passing an array of functions. Each function is rendered on the same axes for comparison. ```APIDOC ## plot - Multiple Functions ### Description Plot multiple functions simultaneously by passing an array of functions. Each function is rendered on the same axes for comparison. ### Method `plot` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Plot two cosine functions with phase shift plot([x -> cos(x), x -> cos(x + pi)], 0:5) ``` ### Response #### Success Response (200) Plots are rendered directly to the terminal with multiple functions overlaid. #### Response Example ``` # Output shows both functions overlaid: # cos(x), cos(x + pi) # 1 ⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤ # ⡇⠉⠉⠉⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠊⠉⠉⠉⠉⠉⠑⠒⠤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸ # -1 ⠓⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠚ # 0 5 ``` ``` -------------------------------- ### Plot Multiple Functions Source: https://context7.com/sunetos/textplots.jl/llms.txt Visualize multiple functions on the same axes by passing an array of functions to the `plot` function. This is useful for comparing different functions. ```julia using TextPlots # Plot two cosine functions with phase shift plot([x -> cos(x), x -> cos(x + pi)], 0:5) ``` -------------------------------- ### Full parameter specification for plot Source: https://context7.com/sunetos/textplots.jl/llms.txt Configures plot dimensions, borders, labels, and scaling functions for a function plot. ```julia plot( cos, # Function or data to plot -10, 10; # Start and stop values for x-axis border=true, # Show box border around plot labels=true, # Show axis labels (x and y values) title=true, # Show auto-generated title from function cols=60, # Number of character columns (width) rows=16, # Number of character rows (height) margin=9, # Left margin width for y-axis labels invert=false, # Invert filled/empty Braille dots gridlines=false, # Show background grid pattern scalefunc=identity # Function to apply to y-values (use log10 for log scale) ) ``` -------------------------------- ### Customize Plot Display Options Source: https://context7.com/sunetos/textplots.jl/llms.txt Customize the appearance of terminal plots using keyword arguments. Options include disabling borders, titles, and labels, as well as setting dimensions (columns, rows) and margins. ```julia using TextPlots # Disable border for cleaner output plot(x -> cos(x), border=false) # Disable all decorations for minimal output plot(x -> cos(x), border=false, title=false, labels=false) # Customize dimensions: cols (width), rows (height), margin (left padding) plot(cos, margin=16, cols=80, rows=30) # Compact plot with minimal dimensions plot(cos, margin=4, cols=12, rows=6) # Enable grid lines for reference plot(sinpi, -2, 2, gridlines=true) # Invert colors (swap filled/empty dots) plot(sinpi, -2, 2, invert=true) # Combine options plot(sinpi, -2, 2, invert=true, gridlines=true) ``` -------------------------------- ### Plotting functions in the terminal Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Plot a function by passing it to the plot command. If no range is specified, it defaults to -10 to 10. ```julia julia> plot(cos) ``` -------------------------------- ### Create Scatter Plots from Data Source: https://context7.com/sunetos/textplots.jl/llms.txt Generate scatter plots using data vectors or matrices. The `plot` function can accept a vector of y-values (auto-generating x-values), a 2D array for multiple series, or explicit x and y coordinate pairs. ```julia using TextPlots # Plot a vector of y-values (x-values are auto-generated as indices) plot(rand(15)) # Plot a 2D array of y-values (multiple series) plot(rand(15, 4)) # Plot explicit x and y coordinate pairs plot([1, 3, 5, 7], [13, 11, 9, 7]) # Plot x-values with matrix of y-values (multiple y series per x) plot([1:2:20], rand(10, 3)) # Plot a range directly plot(1:10) ``` -------------------------------- ### Creating scatter plots Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Generate scatter plots by passing vectors or matrices of y-coordinates to the plot function. ```julia julia> plot(rand(15)) ``` ```julia julia> plot(rand(15, 4)) ``` -------------------------------- ### plot - Scatter Plots with Data Vectors Source: https://context7.com/sunetos/textplots.jl/llms.txt Create scatter plots from data arrays. Supports single y-value vectors, x-y coordinate pairs, and matrices for multiple data series. ```APIDOC ## plot - Scatter Plots with Data Vectors ### Description Create scatter plots from data arrays. Supports single y-value vectors, x-y coordinate pairs, and matrices for multiple data series. ### Method `plot` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Plot a vector of y-values (x-values are auto-generated as indices) plot(rand(15)) # Plot a 2D array of y-values (multiple series) plot(rand(15, 4)) # Plot explicit x and y coordinate pairs plot([1, 3, 5, 7], [13, 11, 9, 7]) # Plot x-values with matrix of y-values (multiple y series per x) plot([1:2:20], rand(10, 3)) # Plot a range directly plot(1:10) ``` ### Response #### Success Response (200) Scatter plots are rendered directly to the terminal. #### Response Example ``` # Output example for scatter plot: # scatter plot # 0.90690 ⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤ # ⡇⠄⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸ # 0.01655 ⠓⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠚ # 1 15 ``` ``` -------------------------------- ### Plotting a function with disabled UI elements Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Render a cosine function in the terminal while disabling the border, title, and labels. ```julia plot(x -> cos(x), border=false, title=false, labels=false) ``` -------------------------------- ### Logarithmic Scale Plotting Source: https://context7.com/sunetos/textplots.jl/llms.txt Use `logplot` for visualizing functions with a logarithmic y-axis scale. This function is a wrapper around `plot` that applies `log10` scaling to the y-values, useful for showing exponential growth or decay linearly. ```julia using TextPlots # Standard exponential plot plot(exp, 0.1:20) # Same function with logarithmic y-scale (shows linear growth) logplot(exp, 0.1:20) # Exponential decay comparison plot(x -> exp(-x/5), 0.01:20) # Curved decay logplot(x -> exp(-x/5), 0.01:20) # Linear decay on log scale ``` -------------------------------- ### plot - Plot a Function Over a Range Source: https://context7.com/sunetos/textplots.jl/llms.txt The primary function for plotting mathematical functions. It takes a real-valued function and an optional range to visualize it in the terminal. ```APIDOC ## plot - Plot a Function Over a Range ### Description The primary function for plotting mathematical functions. Pass any real-valued function and an optional range to visualize it in the terminal using Braille characters. ### Method `plot` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Plot a function with an anonymous lambda and range plot(x -> cos(x), -1:1) # Plot a named function (uses function name as label) plot(sin, -5:5) # Plot without specifying range (defaults to -10:10) plot(cos) # Plot with separate start and stop values (Gadfly-compatible) plot(x -> x^3 - 2x^2 + 3x, -5, 5) ``` ### Response #### Success Response (200) Plots are rendered directly to the terminal. #### Response Example ``` # Output example: # cos(x) # 1 ⡤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢤ # ⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠒⠊⠉⠉⠉⠉⠉⠉⠑⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸ # 0.54030 ⠓⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠒⠚ # -1 1 ``` ``` -------------------------------- ### Plotting with a Vector and Matrix in TextPlots.jl Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Generates a scatter plot using a vector for x coordinates and a matrix for y coordinates. Each row in the matrix represents a set of y values corresponding to the x values. ```julia julia> plot([1:2:20], rand(10, 3)) ``` -------------------------------- ### Plotting with Vectors in TextPlots.jl Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Generates a scatter plot using two vectors for x and y coordinates. The plot is automatically scaled and displayed in the terminal. ```julia julia> plot([1, 3, 5, 7], [13, 11, 9, 7]) ``` -------------------------------- ### logplot - Logarithmic Scale Plotting Source: https://context7.com/sunetos/textplots.jl/llms.txt Plot functions with a logarithmic y-axis scale. This is a convenience wrapper around `plot` that applies `log10` scaling to the y-values. ```APIDOC ## logplot - Logarithmic Scale Plotting ### Description Plot functions with a logarithmic y-axis scale. This is a convenience wrapper around `plot` that applies `log10` scaling to the y-values. ### Method `logplot` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```julia using TextPlots # Standard exponential plot plot(exp, 0.1:20) # Same function with logarithmic y-scale (shows linear growth) logplot(exp, 0.1:20) # Exponential decay comparison plot(x -> exp(-x/5), 0.01:20) # Curved decay logplot(x -> exp(-x/5), 0.01:20) # Linear decay on log scale ``` ### Response #### Success Response (200) Plots are rendered with a logarithmic y-axis scale. #### Response Example (Terminal output will vary based on function and range, showing linear growth for exponential functions on a log scale.) ``` -------------------------------- ### Plotting a Function with Disabled Border in TextPlots.jl Source: https://github.com/sunetos/textplots.jl/blob/master/README.md Generates a plot for a given function (e.g., cos(x)) with the border disabled. The source of the function is used as the label for the plot. ```julia julia> plot(x -> cos(x), border=false) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.