smooth_line


This function creates a smooth line chart with optional log scales, grid, and customization options for line styles, colors, and labels.

smooth_line(**kwargs)

Input variables

</tbody>
Name Description Type
plot_setup

Setup chart dictionary with the following keys:

  • name: Path + name of the figure
  • width: Figure width in SI units
  • height: Figure height in SI units
  • extension: File extension
  • dots_per_inch: Resolution in dots per inch
  • line_width: List of line widths
  • line_style: List of line styles
  • y_axis_label: y axis label
  • x_axis_label: x axis label
  • labels_size: Labels size
  • labels_color: Labels color
  • x_axis_size: x axis size
  • y_axis_size: y axis size
  • axises_color: Axes color
  • x_limit: x axis limits
  • y_limit: y axis limits
  • chart_color: List of chart colors
  • on_grid: Grid on or off
  • y_log: y log scale
  • x_log: x log scale
  • legend_location: Legend location
  • size_legend: Legend size
Dictionary
dataset

Dataset to plot

List or array

Output variables

Name Description Type
None The function displays the smooth line chart on the screen and saves it to the local folder of the .ipynb or .py None

Example 1

Use the smooth_line function to create a smooth line chart from the dataset.

from easyplot_toolbox.easyplot import smooth_line
import numpy as np

x = np.linspace(0, 10, 100)
curve1 = np.sin(x) + np.random.normal(0, 0.1, len(x))
curve2 = np.sin(x) + np.random.normal(0, 0.1, len(x))
curve3 = np.sin(x) + np.random.normal(0, 0.1, len(x))

df = {
    'x': x,
    'curve1': curve1,
    'curve2': curve2,
    'curve3': curve3
}

# Chart setup
chart_config = {
    'name': 'smooth_line_with_confidence_interval',
    'width': 20,  
    'height': 15, 
    'extension': 'jpg',
    'dots_per_inch': 100,
    'line_width': [2],  
    'line_style': ['-'],  
    'y_axis_label': 'Axis Y',
    'x_axis_label': 'Axis X',
    'labels_size': 12,
    'labels_color': 'black',
    'x_axis_size': 10,
    'y_axis_size': 10,
    'axises_color': 'gray',
    'x_limit': [0, 10],  
    'y_limit': [None, None],  
    'chart_color': ['blue'],  
    'on_grid': True,
    'y_log': False,
    'x_log': False,
    'legend_location': 'best',
    'size_legend': 10,
}

# Call function
smooth_line(dataset=df, plot_setup=chart_config)

Figure 1. Joyplot of the dataset.

Notebook example