Example for Compositing Line Plot | teradataml - Compositing Line Plot - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Publication Date
March 2025
Content Type
User Guide
Publication ID
B700-4006-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
ft:sourceId
dita
dita:id
rkb1531260709148
Product Category
Teradata Vantage

This example shows the steps to composite line plot.

  • Generating composite plot on a custom figure.
  • Generating the JPEG image instead of default PNG image.

Example

  • >>> load_example_data("movavg", "ibm_stock")
  • >>> ibm_stock = DataFrame("ibm_stock")
    >>> ibm_stock
        name    period  stockprice
    id
    223  ibm  62/04/05       521.0
    19   ibm  61/06/13       487.0
    263  ibm  62/06/01       364.0
    61   ibm  61/08/11       497.0
    183  ibm  62/02/07       552.0
    265  ibm  62/06/05       370.0
    244  ibm  62/05/04       475.0
    305  ibm  62/08/01       385.0
    326  ibm  62/08/30       387.0
    122  ibm  61/11/08       596.0
  • >>> from teradataml import Figure
    >>> figure = Figure(width=800, height=900, image_type="jpg", heading="Composite Plot")
  • >>> df = ibm_stock.assign(double_price=ibm_stock.stockprice * 2)
    >>> df.plot(x=df.period, y=[df.stockprice, df.double_price], style=['dark orange', 'sand'], figure=figure)

    Composite Line Plot