- Install
- Basic operation
- Basics of programming for electronic work
- Basics of programming for Excel
- Machine learning with scikit-learn
- Visualizing data with matplotlib
- Basic
- General chart
- Show a bar chart with only one series
- Show a bar chart with multiple series
- Draw a stacked bar chart
- Adding data labels to bar charts
- Show a line chart with only one series
- Show a line chart with multiple series
- Adding data labels to line charts
- Show a pie chart with only one series
- Show a pie chart with multiple series
- Statistical chart
- Web programming
- RPA programming
- Miscellaneous programming
- Reference
Show a line chart with only one series
This page explains how to display a simple line chart with only one series.
1. Create the source data for the chart
Enter the data that will be the source of the chart in an Excel sheet.
Enter the values for the X-axis and Y-axis as shown in the image below.

2. Add blocks
Following the steps on the "Creating and displaying charts" page, add the minimum required blocks.
Then, between the chart initialization and chart display blocks, add a block to display the line chart.
This block is long horizontally, so it may be difficult to use if the width of the screen is narrow.
In that case, right-click the block and click "External Input" in the menu to change it to a vertical shape.
You can also right-click a vertical block and click "Inline Input" in the menu to change it to a horizontal shape.
3. Setting the source data for the chart
Use the cell range specification block in the "Excel" - "Cells" group to specify the cell range containing the data that will be the source of the chart with the "X" and "Y" parameters.
If you have entered the item name in the first row of the data, you can also enter the item name in the cell range with the "Y" parameter.
4. Formatting
You can set the format of the line chart using parameters such as "Line width" and "Line type" in the line chart creation block.
The "Label" parameter specifies the label to be added to the line chart series.
If you also include the item name in the cell range in the "Y" parameter, drag the "first value of Y" block in the "matplotlib" - "General chart" group to the "Label" parameter.
![]()
5. Example
Let's assume that you are entering data into Excel, as in the previous example.

In this case, specify cells A2 to A6 for the "X" parameter.
Also, specify cells B1 to B6, including the first item name, for the "Y" parameter.
In addition, drag the "First Y value" block to the "Label" parameter.
When you run this program, the chart at the top of this page will be displayed.
The file for this example can be downloaded from here.
Also, the Excel data file used in this example can be downloaded from here.
When running this example, make sure you have the data file open in Excel beforehand.