beta_plot_line

Draw a line chart

beta_plot_line( 
    df, 
    x, 
    y, 
    palette=PALETTE,
    height=400,
    title=None,
    legend="right"
)

Parameters

  • df (pandas.DataFrame) The data that's plotted on the line chart.

  • x (json) To config the X axis. For example (scroll to Examples), to use the "timestamp" column of df as the X axis and name the X axis "Date", here is how you construct the json: { "title": "Date", "field": "timestamp" }

  • y (json) To config the Y axis. For example (scroll to Examples), to use the "amount" column of df as the Y axis and name the Y axis "Total Deposit", here is how you construct the json: { "title": "Total Deposit", "data":[{ "title":"Amount", "field":"amount" } ] }

  • palette (List) Colors palette used for data series in this chart. There is already a list of default value provided. Optional.

  • legend (str) Where to place the legend text. The value could be left, right and none . The default isright. Optional.

  • title (str) The title of the chart. Optional.

Examples

The "Data" tab shows what the chart data looks like. It will be stored in a variable called "my_data". We will use "timestamp" column as the X axis and "amount" as the Y axis. The "Code" tab shows the code to render the data in a line chart.

#my_data

timestamp              amount      fees
2021-08-02 01:00:00    25.321169   400.07 
2021-08-02 02:00:00    24.926234   399.05
2021-08-02 03:00:00    48.056353   600.23
2021-08-02 04:00:00    0.000000    0.0
2021-08-02 05:00:00    0.000000    50.0 
...
2021-08-09 15:00:00    13.103925   771.03
2021-08-09 16:00:00    114.581884  700.5
2021-08-09 17:00:00    0.000000    96.0 

Output:

Last updated

Was this helpful?