Thursday, June 8, 2023

Horizontal Bars in Tableau


 Horizontal bar charts in Tableau are visualizations that display data using horizontal bars to represent the values of different categories. They are effective for comparing values across categories and identifying patterns or trends.
Here's a step-by-step guide on how to create a horizontal bar chart in Tableau with an example.


Step 1: Prepare your data

Ensure that your data is structured appropriately. It should include categories and their corresponding values to be visualized in the horizontal bar chart.


Horizontal Bar Chart
Step 2: Connect to your data source

Launch Tableau and connect to the data source containing your dataset. This can be an Excel file, a database, or any other supported data source.


Step 3: Create a new worksheet

In Tableau, navigate to the worksheet tab and create a new worksheet. This will serve as the canvas for building your horizontal bar chart.


Step 4: Drag and drop the necessary fields

From the data pane, drag the dimension field (e.g., category) to the Rows shelf. Then, drag the measure field (e.g., value) to the Columns shelf. Tableau will automatically generate a vertical bar chart by default.


Step 5: Rotate the bar chart

To convert the vertical bar chart into a horizontal bar chart, navigate to the toolbar at the top of the Tableau window and click on the "Swap Rows and Columns" button. This will rotate the chart and convert it into a horizontal orientation.


Step 6: Customize the horizontal bar chart

Tableau will generate the horizontal bar chart based on your selected fields. However, you can further customize it to enhance readability and provide more insights:


6.1. Sort the bars: Right-click on the dimension field in the Rows shelf and select "Sort" to sort the bars in ascending or descending order based on the measure field.


6.2. Format the bars: Click on the "Color" or "Size" options in the Marks card to modify the appearance of the bars. You can choose different colors, adjust the thickness, or apply conditional formatting based on the values.


6.3. Add labels: If desired, you can add labels to the bars to display the values or category names. Simply drag the desired fields to the Label shelf.


6.4. Adjust the axis: Right-click on the axis and select "Edit Axis" to modify the range, tick marks, and other formatting options.


Step 7: Save and share

Once you are satisfied with the horizontal bar chart, save the workbook and share it with others. You can export the chart as an image or publish it to Tableau Server or Tableau Public for wider distribution.


For example, let's say you have a dataset that represents the sales figures for different product categories. The sales values for each category are as follows:


Category A: $10,000

Category B: $15,000

Category C: $7,000

Category D: $12,000

By following the steps mentioned above, you can create a horizontal bar chart in Tableau that visually represents the sales values for each category. The y-axis will represent the categories, and the x-axis will represent the sales values. The bars will be oriented horizontally, allowing for easy comparison between the categories. You can sort the bars, format their appearance, add labels, and adjust the axis formatting to enhance the clarity and visual impact of the chart.


The resulting horizontal bar chart will enable you to quickly compare the sales values across different categories and identify the highest and lowest performing categories. It provides a clear visual representation of the relative proportions of sales and allows for easy identification of trends or ano

Thanks for Reading, Subscribe us for more latest Visualization From scratch. 

No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...