LabPlot/Tutorials/Plotting/PlotTextData: Difference between revisions
(Created page with "In this tutorial we're going to show how to plot text data and how to create visualizations like on the plot shown below with numerical data on the y-axis and text data on the x-axis: This example and the data is taken from the example project "SLOC History" that can be found in the collection of [https://labplot.kde.org/2022/05/26/example-projects/ example projects] that are part of LabPlot's installation. More background for the data visualized in that example project...") |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
In this tutorial we're going to show how to plot text data and how to create visualizations like on the plot shown below with numerical data on the y-axis and text data on the x-axis: | In this tutorial we're going to show how to plot text data and how to create visualizations like on the plot shown below with numerical data on the y-axis and text data on the x-axis: | ||
[[File:LabPlot tutorial plot text data final plot.png |500px|thumb|center]] | |||
This example and the data is taken from the example project "SLOC History" that can be found in the collection of [https://labplot.kde.org/2022/05/26/example-projects/ example projects] that are part of LabPlot's installation. More background for the data visualized in that example project can be found in the [https://labplot.kde.org/2019/11/05/sloccount-git-history-of-labplot/ blog post]. | This example and the data is taken from the example project "SLOC History" that can be found in the collection of [https://labplot.kde.org/2022/05/26/example-projects/ example projects] that are part of LabPlot's installation. More background for the data visualized in that example project can be found in the [https://labplot.kde.org/2019/11/05/sloccount-git-history-of-labplot/ blog post]. | ||
1. Let's start with the data: | 1. Let's start with the data: | ||
[[File:LabPlot tutorial plot text data spreadsheet original.png |500px|thumb|center]] | |||
Here we have one text column containing the strings representing LabPlot's release versions as well as multiple numerical columns. | |||
2. To plot the text data in LabPlot we need to add an index column first. For this, we add a new column and fill it with row numbers: | |||
[[File:LabPlot tutorial plot text data spreadsheet generate index.png |500px|thumb|center]] | |||
Set the plot designation to X for the new column so it's properly recognized in the "Plot Data"-dialog in the spreadsheet: | |||
[[File:LabPlot tutorial plot text data spreadsheet with index.png |500px|thumb|center]] | |||
3. Now we can plot the numerical values against this index column as usual: | |||
[[File:LabPlot tutorial plot text data initial plot.png |500px|thumb|center]] | |||
4. The data is properly plotted now and we only need to show a tick on the axis for every single value and to the text data in the axis labels. For this, select the x-axis and navigate in the Properties Explorer to the tab "Ticks". Specify the spacing 1 for axis ticks and use "Custom Column" for the label type and specify the column "release" from the spreadsheet as the label column: | |||
[[File:LabPlot tutorial plot text data axis dock text label column.png |250px|thumb|center]] | |||
With this, LabPlot will use the string values from the spreadsheet column to label the axis ticks. | |||
5. Apply additional formatting, rename the axis title labels and add the legend to get the final result as shown above. | |||
Latest revision as of 07:21, 24 March 2023
In this tutorial we're going to show how to plot text data and how to create visualizations like on the plot shown below with numerical data on the y-axis and text data on the x-axis:
This example and the data is taken from the example project "SLOC History" that can be found in the collection of example projects that are part of LabPlot's installation. More background for the data visualized in that example project can be found in the blog post.
1. Let's start with the data:
Here we have one text column containing the strings representing LabPlot's release versions as well as multiple numerical columns.
2. To plot the text data in LabPlot we need to add an index column first. For this, we add a new column and fill it with row numbers:
Set the plot designation to X for the new column so it's properly recognized in the "Plot Data"-dialog in the spreadsheet:
3. Now we can plot the numerical values against this index column as usual:
4. The data is properly plotted now and we only need to show a tick on the axis for every single value and to the text data in the axis labels. For this, select the x-axis and navigate in the Properties Explorer to the tab "Ticks". Specify the spacing 1 for axis ticks and use "Custom Column" for the label type and specify the column "release" from the spreadsheet as the label column:
With this, LabPlot will use the string values from the spreadsheet column to label the axis ticks.
5. Apply additional formatting, rename the axis title labels and add the legend to get the final result as shown above.