Skip to content

Plots

Plots

Plots in Taipy Designer may be made with the following widget types:

Plotly-based widgets share common parameters, especially hideModeBar which allows to hide plot options toolbar at dashboard play.

Plotly line

Allows to quickly display line charts, when x and y axis are expressed as lists of numbers. The parameter numberOfAxis allows to specifiy up to 8 y-axis actuators (named y1 to y8), sharing the same x-axis actuator (named x). Widget layout may be configured in the "Graphical properties" tab.

line-chart

Plotly bar

Here parameter numberOfAxis allows to specify couples of x and y axis actuators (named x1, y1 to x8, y8).

Some examples :

bar-chart

stack-bar-chart

Plotly pie

This widget has two actuators :

  • values: an list of values to be displayed as pie chart
  • labels: an optional list of labels associated to values

pie-chart

Example :

Plotly Python Generic

This widget expects a Plotly figure Python object. Below a code example:

import plotly.express as px

df = px.data.gapminder().query("country=='Canada'")
fig = px.line(df, x="year", y="lifeExp", title='Life expectancy in Canada')

return fig

All receipes may be found in Ploty Python documentation.

No call to fig.show() is needed because rendering process will be entirely handled by Taipy Designer according to its rendering rules.

Example:

Matplotlib

In the same way as Plotly Python widget, Matplotlib widget expect a figure object as actuator. Below a code example:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
bar_labels = ['red', 'blue', '_red', 'orange']
bar_colors = ['tab:red', 'tab:blue', 'tab:red', 'tab:orange']

ax.bar(fruits, counts, label=bar_labels, color=bar_colors)

ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')

All receipes may be found in Matplotlib documentation.

  • No call to plt.show() is needed because rendering process will be entirely handled by Taipy Designer according to its rendering rules.

Example:

ECharts

Simply, copy and paste the needed visualization from ECharts examples gallery and convert it to Python. This example shall return an option JSON according to ECharts grammar. Finally, connect this variable to the option widget actuator.

Some examples: